├── .travis.yml
├── QCloudCSharpSDK
├── COSXML
│ ├── Model
│ │ ├── Bucket
│ │ │ ├── DeleteBucketTaggingResult.cs
│ │ │ ├── DeleteBucketWebsiteResult.cs
│ │ │ ├── PutBucketWebsiteResult.cs
│ │ │ ├── PutBucketDomainResult.cs
│ │ │ ├── PutBucketPolicyResult.cs
│ │ │ ├── PutBucketLoggingResult.cs
│ │ │ ├── PutBucketRefererResult.cs
│ │ │ ├── PutBucketTaggingResult.cs
│ │ │ ├── PutBucketInventoryResult.cs
│ │ │ ├── PutBucketVersioningResult.cs
│ │ │ ├── DeleteBucketInventoryResult.cs
│ │ │ ├── DeleteBucketReplicationResult.cs
│ │ │ ├── PutBucketReplicationResult.cs
│ │ │ ├── DeleteBucketResult.cs
│ │ │ ├── GetBucketDomainResult.cs
│ │ │ ├── GetBucketWebsiteResult.cs
│ │ │ ├── GetBucketInventoryResult.cs
│ │ │ ├── PutBucketResult.cs
│ │ │ ├── ListBucketInventoryResult.cs
│ │ │ ├── GetBucketIntelligentTieringResult.cs
│ │ │ ├── PutBucketACLResult.cs
│ │ │ ├── DeleteBucketPolicyResult.cs
│ │ │ ├── HeadBucketResult.cs
│ │ │ ├── PutBucketCORSResult.cs
│ │ │ ├── DeleteBucketCORSResult.cs
│ │ │ ├── GetBucketTaggingResult.cs
│ │ │ ├── GetBucketPolicyResult.cs
│ │ │ ├── PutBucketLifecycleResult.cs
│ │ │ ├── DeleteBucketLifecycleResult.cs
│ │ │ ├── GetBucketLoggingResult.cs
│ │ │ ├── ListBucketVersionsResult.cs
│ │ │ ├── GetBucketVersioningResult.cs
│ │ │ ├── GetBucketReplicationResult.cs
│ │ │ ├── GetBucketDomainRequest.cs
│ │ │ ├── GetBucketLoggingRequest.cs
│ │ │ ├── GetBucketWebsiteRequest.cs
│ │ │ ├── GetBucketTaggingRequest.cs
│ │ │ ├── DeleteBucketTaggingRequest.cs
│ │ │ ├── DeleteBucketWebsiteRequest.cs
│ │ │ ├── GetBucketVersioningRequest.cs
│ │ │ ├── GetBucketReplicationRequest.cs
│ │ │ ├── DeleteBucketReplicationRequest.cs
│ │ │ ├── GetBucketRefererResult.cs
│ │ │ ├── DeleteBucketRequest.cs
│ │ │ ├── HeadBucketRequest.cs
│ │ │ ├── DoesBucketExistRequest.cs
│ │ │ ├── DeleteBucketCORSRequest.cs
│ │ │ ├── GetBucketACLRequest.cs
│ │ │ ├── GetBucketPolicyRequest.cs
│ │ │ ├── GetBucketCORSRequest.cs
│ │ │ ├── DeleteBucketPolicyRequest.cs
│ │ │ ├── GetBucketRefererRequest.cs
│ │ │ ├── GetBucketLifecycleRequest.cs
│ │ │ ├── DeleteBucketLifecycleRequest.cs
│ │ │ ├── GetBucketInventoryRequest.cs
│ │ │ ├── GetBucketResult.cs
│ │ │ ├── DeleteBucketInventoryRequest.cs
│ │ │ ├── GetBucketCORSResult.cs
│ │ │ ├── GetBucketIntelligentTieringRequest.cs
│ │ │ ├── ListMultiUploadsResult.cs
│ │ │ ├── GetBucketACLResult.cs
│ │ │ ├── GetBucketLifecycleResult.cs
│ │ │ ├── ListBucketInventoryRequest.cs
│ │ │ ├── PutBucketDomainRequest.cs
│ │ │ ├── PutBucketPolicyRequest.cs
│ │ │ ├── PutBucketTaggingRequest.cs
│ │ │ ├── PutBucketRefererRequest.cs
│ │ │ ├── PutBucketVersioningRequest.cs
│ │ │ ├── PutBucketLoggingRequest.cs
│ │ │ ├── ListBucketVersionsRequest.cs
│ │ │ ├── PutBucketIntelligentTieringRequest.cs
│ │ │ ├── PutBucketLifecycleRequest.cs
│ │ │ ├── PutBucketCORSRequest.cs
│ │ │ └── GetBucketRequest.cs
│ │ ├── CI
│ │ │ ├── GetSnapshotResult.cs
│ │ │ ├── GetMediaInfoResult.cs
│ │ │ ├── CreateDocProcessJobsResult.cs
│ │ │ ├── SubmitDocumentProcessJobResult.cs
│ │ │ ├── GetTextCensorJobResult.cs
│ │ │ ├── DescribeMediaBucketsResult.cs
│ │ │ ├── GetAudioCensorJobResult.cs
│ │ │ ├── GetVideoCensorJobResult.cs
│ │ │ ├── SubmitCensorJobResult.cs
│ │ │ ├── GetDocumentCensorJobResult.cs
│ │ │ ├── ImageProcessResult.cs
│ │ │ ├── QRCodeRecognitionResult.cs
│ │ │ ├── SubmitTextCensorJobResult.cs
│ │ │ ├── SensitiveContentRecognitionResult.cs
│ │ │ ├── QRCodeRecognitionRequest.cs
│ │ │ ├── GetMediaInfoRequest.cs
│ │ │ ├── GetTextCensorJobRequest.cs
│ │ │ ├── GetAudioCensorJobRequest.cs
│ │ │ ├── GetVideoCensorJobRequest.cs
│ │ │ ├── GetDocumentCensorJobRequest.cs
│ │ │ ├── DescribeDocProcessJobResult.cs
│ │ │ ├── DescribeDocProcessJobsResult.cs
│ │ │ ├── DescribeDocProcessJobRequest.cs
│ │ │ ├── ImageProcessRequest.cs
│ │ │ ├── DescribeFileZipProcessJobsRequest.cs
│ │ │ ├── DescribeFileZipProcessJobsResult.cs
│ │ │ ├── CreateFileZipProcessJobsResult.cs
│ │ │ ├── DescribeMediaBucketsRequest.cs
│ │ │ ├── SensitiveContentRecognitionRequest.cs
│ │ │ ├── SubmitDocumentCensorJobRequest.cs
│ │ │ ├── SubmitTextCensorJobRequest.cs
│ │ │ ├── SubmitAudioCensorJobRequest.cs
│ │ │ └── GetSnapshotRequest.cs
│ │ ├── Object
│ │ │ ├── DeleteObjectResult.cs
│ │ │ ├── PutObjectTaggingResult.cs
│ │ │ ├── PutObjectACLResult.cs
│ │ │ ├── DeleteObjectTaggingResult.cs
│ │ │ ├── AbortMultipartUploadResult.cs
│ │ │ ├── RestoreObjectResult.cs
│ │ │ ├── PostObjectResult.cs
│ │ │ ├── GetObjectACLRequest.cs
│ │ │ ├── CopyObjectResult.cs
│ │ │ ├── GetObjectTaggingResult.cs
│ │ │ ├── ListPartsResult.cs
│ │ │ ├── UploadPartCopyResult.cs
│ │ │ ├── DeleteMultiObjectResult.cs
│ │ │ ├── CompleteMultipartUploadResult.cs
│ │ │ ├── GetObjectACLResult.cs
│ │ │ ├── InitMultipartUploadResult.cs
│ │ │ ├── UploadPartResult.cs
│ │ │ ├── DeleteObjectRequest.cs
│ │ │ ├── HeadObjectRequest.cs
│ │ │ ├── DoesObjectExistRequest.cs
│ │ │ ├── AppendObjectResult.cs
│ │ │ ├── GetObjectTaggingRequest.cs
│ │ │ ├── DeleteObjectTaggingRequest.cs
│ │ │ ├── GetObjectResult.cs
│ │ │ ├── PutObjectResult.cs
│ │ │ ├── PutObjectTaggingRequest.cs
│ │ │ ├── AbortMultipartUploadRequest.cs
│ │ │ ├── GetObjectBytesResult.cs
│ │ │ ├── GetObjectBytesRequest.cs
│ │ │ ├── HeadObjectResult.cs
│ │ │ ├── PutObjectACLRequest.cs
│ │ │ └── ListPartsRequest.cs
│ │ ├── Tag
│ │ │ ├── SelectObject.cs
│ │ │ ├── VersioningConfiguration.cs
│ │ │ ├── Delete.cs
│ │ │ ├── DomainConfiguration.cs
│ │ │ ├── ListDocProcessDetail.cs
│ │ │ ├── CopyPartResult.cs
│ │ │ ├── CensorJobDetail.cs
│ │ │ ├── InitiateMultipartUpload.cs
│ │ │ ├── CompleteMultipartUpload.cs
│ │ │ ├── IntelligentTieringConfiguration.cs
│ │ │ ├── CosServerError.cs
│ │ │ ├── MediaBuckets.cs
│ │ │ ├── Tagging.cs
│ │ │ ├── GrantAccount.cs
│ │ │ ├── BucketLoggingStatus.cs
│ │ │ ├── CopyObject.cs
│ │ │ ├── QRRecognitionResult.cs
│ │ │ ├── CompleteResult.cs
│ │ │ ├── RestoreConfigure.cs
│ │ │ ├── PreSignatureStruct.cs
│ │ │ ├── ListInventoryConfiguration.cs
│ │ │ ├── ObjectSelectionFormat.cs
│ │ │ ├── WebsiteConfiguration.cs
│ │ │ └── RefererConfiguration.cs
│ │ └── Service
│ │ │ ├── GetServiceResult.cs
│ │ │ └── GetServiceRequest.cs
│ ├── Network
│ │ ├── RetryStrategy.cs
│ │ └── Response.cs
│ ├── Utils
│ │ ├── HttpDateTimeUtils.cs
│ │ ├── CosValueAttribute.cs
│ │ ├── EnumUtils.cs
│ │ └── SystemUtils.cs
│ ├── Log
│ │ ├── ILog.cs
│ │ └── LogImpl.cs
│ ├── Common
│ │ ├── CosMetaDataDirective.cs
│ │ ├── CosRequestMethod.cs
│ │ ├── CosACL.cs
│ │ ├── CosGrantPermission.cs
│ │ ├── CosStorageClass.cs
│ │ ├── CosClientError.cs
│ │ └── CosVersion.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Transfer
│ │ ├── XmlParse.cs
│ │ └── XmlBuilder.cs
│ ├── COSXML.sln
│ ├── CosException
│ │ └── CosClientException.cs
│ ├── Auth
│ │ └── QCloudCredentials.cs
│ ├── Listener
│ │ └── CosCallback.cs
│ └── COSXML-Netcore.csproj
├── COSXMLTests
│ ├── packages.config
│ ├── Utils
│ │ ├── HttpUrlTest.cs
│ │ ├── ResponseTest.cs
│ │ └── TimeUtilsTests.cs
│ ├── COSXMLTests.csproj
│ ├── COSXMLTests.sln
│ └── ObsoleteAsyncTest.cs
├── COSXMLDemo
│ ├── COSXMLDemo.csproj
│ ├── COSXMLDemo.sln
│ ├── Bucket
│ │ ├── HeadBucket.cs
│ │ ├── DeleteBucket.cs
│ │ ├── DoesBucketExist.cs
│ │ ├── ListBucket.cs
│ │ └── CreateBucket.cs
│ └── CI
│ │ ├── DescribeDocProcessJob.cs
│ │ └── DescribeFileZipProcessJobs.cs
└── QCloudCSharpSDK.sln
├── .gitignore
├── LICENSE
├── .github
└── workflows
│ └── auto-changelog.yml
└── README.md
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: csharp
2 | mono: none
3 | dotnet: 2.2.402
4 | script:
5 | - cd QCloudCSharpSDK/COSXMLTests
6 | - dotnet restore
7 | - dotnet test
8 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/DeleteBucketTaggingResult.cs:
--------------------------------------------------------------------------------
1 |
2 |
3 | namespace COSXML.Model.Bucket
4 | {
5 | public sealed class DeleteBucketTaggingResult : CosResult
6 | {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/DeleteBucketWebsiteResult.cs:
--------------------------------------------------------------------------------
1 |
2 |
3 | namespace COSXML.Model.Bucket
4 | {
5 | public sealed class DeleteBucketWebsiteResult : CosResult
6 | {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketWebsiteResult.cs:
--------------------------------------------------------------------------------
1 |
2 |
3 | namespace COSXML.Model.Bucket
4 | {
5 | public sealed class PutBucketWebsiteResult : CosResult
6 | {
7 |
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Network/RetryStrategy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace COSXML.Network
6 | {
7 | public sealed class RetryStrategy
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Utils/HttpDateTimeUtils.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Utils
7 | {
8 | public sealed class HttpDateTimeUtils
9 | {
10 |
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Log/ILog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Log
7 | {
8 | public interface ILog
9 | {
10 | void PrintLog(string message);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXMLTests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketDomainResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | public sealed class PutBucketDomainResult : CosResult
9 | {
10 | }
11 | }
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketPolicyResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace COSXML.Model.Bucket
6 | {
7 | public sealed class PutBucketPolicyResult : CosResult
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketLoggingResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace COSXML.Model.Bucket
6 | {
7 | public sealed class PutBucketLoggingResult : CosResult
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketRefererResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace COSXML.Model.Bucket
6 | {
7 | public sealed class PutBucketRefererResult : CosResult
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketTaggingResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | public sealed class PutBucketTaggingResult : CosResult
9 | {
10 | }
11 | }
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketInventoryResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace COSXML.Model.Bucket
6 | {
7 | public sealed class PutBucketInventoryResult : CosResult
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketVersioningResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | public sealed class PutBucketVersioningResult : CosResult
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/DeleteBucketInventoryResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace COSXML.Model.Bucket
6 | {
7 | public sealed class DeleteBucketInventoryResult : CosResult
8 | {
9 |
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/DeleteBucketReplicationResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | public sealed class DeleteBucketReplicationResult : CosResult
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketReplicationResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | public sealed class PutBucketReplicationResult : CosResult
9 | {
10 |
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/DeleteBucketResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | ///
9 | /// 删除 空 Bucket返回的结果
10 | ///
11 | public sealed class DeleteBucketResult : CosResult
12 | {
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/GetSnapshotResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using COSXML.Model.Tag;
5 | using COSXML.Transfer;
6 |
7 | namespace COSXML.Model.CI
8 | {
9 | ///
10 | /// 媒体截图结果
11 | ///
12 | public sealed class GetSnapshotResult : CosResult
13 | {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Log/LogImpl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using System.Diagnostics;
6 |
7 | namespace COSXML.Log
8 | {
9 | public sealed class LogImpl : ILog
10 | {
11 |
12 | public void PrintLog(string message)
13 | {
14 | Trace.WriteLine(message);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketDomainResult.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Model.Tag;
2 | using COSXML.Transfer;
3 |
4 | namespace COSXML.Model.Bucket
5 | {
6 | public sealed class GetBucketDomainResult : CosDataResult
7 | {
8 | public DomainConfiguration domainConfiguration {
9 | get{ return _data; }
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketWebsiteResult.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Model.Tag;
2 | using COSXML.Transfer;
3 |
4 | namespace COSXML.Model.Bucket
5 | {
6 | public sealed class GetBucketWebsiteResult : CosDataResult
7 | {
8 | public WebsiteConfiguration websiteConfiguration {
9 | get {return _data; }
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketInventoryResult.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Model.Tag;
2 | using COSXML.Transfer;
3 | namespace COSXML.Model.Bucket
4 | {
5 | public sealed class GetBucketInventoryResult : CosDataResult
6 | {
7 |
8 | public InventoryConfiguration inventoryConfiguration {
9 | get{ return _data; }
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.swp
2 | *.suo
3 | *.user
4 |
5 |
6 | **/bin/
7 | **/obj/
8 | #folder
9 | QCloudCSharpSDK/COSXML/bin
10 | QCloudCSharpSDK/COSXML/obj
11 | QCloudCSharpSDK/COSXMLTests/obj
12 | QCloudCSharpSDK/COSXMLTests/bin
13 | QCloudCSharpSDK/COSXMLTests/TestResults
14 | QCloudCSharpSDK/COSXMLTests/coveragereport
15 | QCloudCSharpSDK/NCOS
16 | QCloudCSharpSDK/.idea
17 | *.vs
18 | .vscode
19 | **/.DS_Store
20 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Common/CosMetaDataDirective.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Utils;
7 |
8 | namespace COSXML.Common
9 | {
10 | public enum CosMetaDataDirective
11 | {
12 | [CosValue("Copy")]
13 | Copy = 0,
14 |
15 | [CosValue("Replaced")]
16 | Replaced
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | ///
9 | /// 创建 Bucket 返回的结果
10 | ///
11 | ///
12 | public sealed class PutBucketResult : CosResult
13 | {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/DeleteObjectResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Object
7 | {
8 | ///
9 | /// 删除对象返回的结果
10 | ///
11 | ///
12 | public sealed class DeleteObjectResult : CosResult
13 | {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/ListBucketInventoryResult.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Model.Tag;
2 | using COSXML.Transfer;
3 |
4 |
5 | namespace COSXML.Model.Bucket
6 | {
7 | public sealed class ListBucketInventoryResult : CosDataResult
8 | {
9 | public ListInventoryConfiguration listInventoryConfiguration {
10 | get {return _data; }
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketIntelligentTieringResult.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Model.Tag;
2 | using COSXML.Transfer;
3 |
4 | namespace COSXML.Model.Bucket
5 | {
6 | public sealed class GetBucketIntelligentTieringResult : CosDataResult
7 | {
8 | public IntelligentTieringConfiguration configuration {
9 | get{ return _data; }
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketACLResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | ///
9 | /// 设置 Bucket ACL返回的结果
10 | ///
11 | ///
12 | public sealed class PutBucketACLResult : CosResult
13 | {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/PutObjectTaggingResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Object
7 | {
8 | ///
9 | /// 设置对象标签返回的结果
10 | ///
11 | ///
12 | public sealed class PutObjectTaggingResult : CosResult
13 | {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/DeleteBucketPolicyResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace COSXML.Model.Bucket
6 | {
7 | ///
8 | /// 删除 Bucket 权限策略返回的结果
9 | ///
10 | ///
11 | public sealed class DeleteBucketPolicyResult : CosResult
12 | {
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/HeadBucketResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | ///
9 | /// 检索 Bucket 是否存在的返回结果
10 | ///
11 | ///
12 | public sealed class HeadBucketResult : CosResult
13 | {
14 |
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketCORSResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | ///
9 | /// 设置 Bucket CORS 返回的结果
10 | ///
11 | ///
12 | public sealed class PutBucketCORSResult : CosResult
13 | {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/PutObjectACLResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Object
7 | {
8 | ///
9 | /// 设置 对象 的ACL返回的结果
10 | ///
11 | ///
12 | public sealed class PutObjectACLResult : CosResult
13 | {
14 |
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/DeleteBucketCORSResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | ///
9 | /// 删除 Bucket CORS 返回的结果
10 | ///
11 | ///
12 | public sealed class DeleteBucketCORSResult : CosResult
13 | {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/DeleteObjectTaggingResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Object
7 | {
8 | ///
9 | /// 删除对象标签返回的结果
10 | ///
11 | ///
12 | public sealed class DeleteObjectTaggingResult : CosResult
13 | {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketTaggingResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 |
8 | namespace COSXML.Model.Bucket
9 | {
10 | public sealed class GetBucketTaggingResult : CosDataResult
11 | {
12 | public Tagging tagging {
13 | get {return _data; }
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketPolicyResult.cs:
--------------------------------------------------------------------------------
1 | namespace COSXML.Model.Bucket
2 | {
3 | ///
4 | /// 获取 Bucket 权限策略
5 | ///
6 | ///
7 | public sealed class GetBucketPolicyResult : CosDataStringResult
8 | {
9 | public string Data
10 | {
11 | get{ return _data; }
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketLifecycleResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | ///
9 | /// 设置 Bucket 生命周期的返回结果
10 | ///
11 | ///
12 | public sealed class PutBucketLifecycleResult : CosResult
13 | {
14 |
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/AbortMultipartUploadResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Object
7 | {
8 | ///
9 | /// 舍弃一个分块上传并删除已上传的块返回的结果
10 | ///
11 | ///
12 | public sealed class AbortMultipartUploadResult : CosResult
13 | {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/DeleteBucketLifecycleResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | ///
9 | /// 删除 Bucket Lifecycle 返回的结果
10 | ///
11 | ///
12 | public sealed class DeleteBucketLifecycleResult : CosResult
13 | {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/RestoreObjectResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Object
7 | {
8 | ///
9 | /// 对一个通过 COS 归档为 archive 类型的对象进行恢复返回的结果
10 | ///
11 | ///
12 | public sealed class RestoreObjectResult : CosResult
13 | {
14 |
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketLoggingResult.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Model.Tag;
2 | using COSXML.Transfer;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Text;
6 |
7 | namespace COSXML.Model.Bucket
8 | {
9 | public sealed class GetBucketLoggingResult : CosDataResult
10 | {
11 | public BucketLoggingStatus bucketLoggingStatus {
12 | get{ return _data; }
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/ListBucketVersionsResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 |
8 | namespace COSXML.Model.Bucket
9 | {
10 | public sealed class ListBucketVersionsResult : CosDataResult
11 | {
12 | public ListBucketVersions listBucketVersions {
13 | get {return _data; }
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXMLDemo/COSXMLDemo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Exe
9 | net6.0
10 | enable
11 | enable
12 | COSXMLDemo
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketVersioningResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 |
8 | namespace COSXML.Model.Bucket
9 | {
10 | public sealed class GetBucketVersioningResult : CosDataResult
11 | {
12 | public VersioningConfiguration versioningConfiguration {
13 | get {return _data; }
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Utils/CosValueAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Utils
7 | {
8 | public sealed class CosValueAttribute : Attribute
9 | {
10 | public string Value
11 | {
12 | get;
13 | private set;
14 | }
15 |
16 | public CosValueAttribute(string value)
17 | {
18 | this.Value = value;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXMLTests/Utils/HttpUrlTest.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Network;
2 | using NUnit.Framework;
3 |
4 | namespace COSXML.Utils.Tests;
5 | [TestFixture()]
6 | public class HttpUrlTest
7 | {
8 | [Test()]
9 | public void ToStringTest()
10 | {
11 | HttpUrl httpUrl = new HttpUrl();
12 | httpUrl.UserPassword = "testpassword";
13 | httpUrl.Host = "2001:0db8:85a3:0000:0000:8a2e:0370:7334";
14 | httpUrl.Scheme = "http";
15 | httpUrl.ToString();
16 | }
17 | }
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketReplicationResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 |
8 | namespace COSXML.Model.Bucket
9 | {
10 | public sealed class GetBucketReplicationResult : CosDataResult
11 | {
12 | public ReplicationConfiguration replicationConfiguration {
13 | get{ return _data; }
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/PostObjectResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 |
8 | namespace COSXML.Model.Object
9 | {
10 | ///
11 | /// 使用者用表单的形式将文件(Object)上传至指定 Bucket 中.
12 | ///
13 | ///
14 | public sealed class PostObjectResult : CosResult
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/GetMediaInfoResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using COSXML.Model.Tag;
5 | using COSXML.Transfer;
6 |
7 | namespace COSXML.Model.CI
8 | {
9 | ///
10 | /// 获取媒体信息结果
11 | ///
12 | public sealed class GetMediaInfoResult : CosDataResult
13 | {
14 | public MediaInfoResult mediaInfoResult {
15 | get { return _data; }
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketDomainRequest.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Common;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | public sealed class GetBucketDomainRequest : BucketRequest
9 | {
10 | public GetBucketDomainRequest(string bucket) : base(bucket)
11 | {
12 | this.method = CosRequestMethod.GET;
13 | this.queryParameters.Add("domain", null);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketLoggingRequest.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Common;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | public sealed class GetBucketLoggingRequest : BucketRequest
9 | {
10 | public GetBucketLoggingRequest(string bucket) : base(bucket)
11 | {
12 | this.method = CosRequestMethod.GET;
13 | this.queryParameters.Add("logging", null);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketWebsiteRequest.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Common;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | public sealed class GetBucketWebsiteRequest : BucketRequest
9 | {
10 | public GetBucketWebsiteRequest(string bucket) : base(bucket)
11 | {
12 | this.method = CosRequestMethod.GET;
13 | this.queryParameters.Add("website", null);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXMLDemo/COSXMLDemo.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.0.31903.59
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(SolutionProperties) = preSolution
12 | HideSolutionNode = FALSE
13 | EndGlobalSection
14 | EndGlobal
15 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketTaggingRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Bucket
8 | {
9 | public sealed class GetBucketTaggingRequest : BucketRequest
10 | {
11 | public GetBucketTaggingRequest(string bucket) : base(bucket)
12 | {
13 | this.method = CosRequestMethod.GET;
14 | this.queryParameters.Add("tagging", null);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/DeleteBucketTaggingRequest.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Common;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | public sealed class DeleteBucketTaggingRequest : BucketRequest
9 | {
10 | public DeleteBucketTaggingRequest(string bucket) : base(bucket)
11 | {
12 | this.method = CosRequestMethod.DELETE;
13 | this.queryParameters.Add("tagging", null);
14 | }
15 |
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/DeleteBucketWebsiteRequest.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Common;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | public sealed class DeleteBucketWebsiteRequest : BucketRequest
9 | {
10 | public DeleteBucketWebsiteRequest(string bucket) : base(bucket)
11 | {
12 | this.method = CosRequestMethod.DELETE;
13 | this.queryParameters.Add("website", null);
14 | }
15 |
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketVersioningRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Bucket
8 | {
9 | public sealed class GetBucketVersioningRequest : BucketRequest
10 | {
11 | public GetBucketVersioningRequest(string bucket) : base(bucket)
12 | {
13 | this.method = CosRequestMethod.GET;
14 | this.queryParameters.Add("versioning", null);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/CreateDocProcessJobsResult.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Model.Tag;
2 |
3 | namespace COSXML.Model.CI
4 | {
5 | ///
6 | ///
7 | ///
8 | public sealed class CreateDocProcessJobsResult : CosDataResult
9 | {
10 |
11 | ///
12 | /// 文档转码结果
13 | ///
14 | ///
15 | public DocProcessResponse docProcessResponse {
16 | get {return _data; }
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/SubmitDocumentProcessJobResult.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Model.Tag;
2 |
3 | namespace COSXML.Model.CI
4 | {
5 | ///
6 | ///
7 | ///
8 | public sealed class SubmitDocumentProcessJobResult : CosDataResult
9 | {
10 |
11 | ///
12 | /// 文档转码结果
13 | ///
14 | ///
15 | public DocProcessResponse docProcessResponse {
16 | get {return _data; }
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketReplicationRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Bucket
8 | {
9 | public sealed class GetBucketReplicationRequest : BucketRequest
10 | {
11 | public GetBucketReplicationRequest(string bucket)
12 | : base(bucket)
13 | {
14 | this.method = CosRequestMethod.GET;
15 | this.queryParameters.Add("replication", null);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Common/CosRequestMethod.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Common
7 | {
8 | public sealed class CosRequestMethod
9 | {
10 | public const string GET = "GET";
11 |
12 | public const string POST = "POST";
13 |
14 | public const string PUT = "PUT";
15 |
16 | public const string DELETE = "DELETE";
17 |
18 | public const string HEAD = "HEAD";
19 |
20 | public const string OPTIONS = "OPTIONS";
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/DeleteBucketReplicationRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Bucket
8 | {
9 | public sealed class DeleteBucketReplicationRequest : BucketRequest
10 | {
11 | public DeleteBucketReplicationRequest(string bucket)
12 | : base(bucket)
13 | {
14 | this.method = CosRequestMethod.DELETE;
15 | this.queryParameters.Add("replication", null);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketRefererResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using COSXML.Model.Tag;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | ///
9 | /// 获取 Bucket 防盗链配置
10 | ///
11 | ///
12 | public sealed class GetBucketRefererResult : CosDataResult
13 | {
14 | public RefererConfiguration refererConfiguration {
15 | get{ return _data; }
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/DeleteBucketRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Bucket
8 | {
9 | public sealed class DeleteBucketRequest : BucketRequest
10 | {
11 | ///
12 | /// 删除 空 Bucket
13 | ///
14 | ///
15 | public DeleteBucketRequest(string bucket)
16 | : base(bucket)
17 | {
18 | this.method = CosRequestMethod.DELETE;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/HeadBucketRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Bucket
8 | {
9 | ///
10 | /// 检索 Bucket 是否存在
11 | ///
12 | ///
13 | public sealed class HeadBucketRequest : BucketRequest
14 | {
15 | public HeadBucketRequest(string bucket)
16 | : base(bucket)
17 | {
18 | this.method = CosRequestMethod.HEAD;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/GetTextCensorJobResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using COSXML.Model.Tag;
5 | using COSXML.Transfer;
6 |
7 | namespace COSXML.Model.CI
8 | {
9 | ///
10 | /// 文本审核结果
11 | ///
12 | public sealed class GetTextCensorJobResult : CosDataResult
13 | {
14 | ///
15 | /// 文本审核结果
16 | ///
17 | ///
18 | public TextCensorResult resultStruct {
19 | get {return _data; }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的常规信息通过以下
6 | // 特性集控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyCopyright("Copyright © 2021")]
9 | [assembly: AssemblyTrademark("")]
10 | [assembly: AssemblyCulture("")]
11 |
12 | // 将 ComVisible 设置为 false 使此程序集中的类型
13 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
14 | // 则将该类型上的 ComVisible 特性设置为 true。
15 | [assembly: ComVisible(false)]
16 |
17 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
18 | [assembly: Guid("db30c29b-1676-4e48-9312-23ae7d3f4b62")]
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/DescribeMediaBucketsResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using COSXML.Model.Tag;
5 | using COSXML.Transfer;
6 |
7 | namespace COSXML.Model.CI
8 | {
9 | ///
10 | /// 图片审核结果
11 | ///
12 | public sealed class DescribeMediaBucketsResult : CosDataResult
13 | {
14 | ///
15 | /// 获取媒体buckets结果
16 | ///
17 | ///
18 | public MediaBuckets mediaBuckets {
19 | get {return _data; }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/GetAudioCensorJobResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using COSXML.Model.Tag;
5 | using COSXML.Transfer;
6 |
7 | namespace COSXML.Model.CI
8 | {
9 | ///
10 | /// 查询音频审核结果
11 | ///
12 | public sealed class GetAudioCensorJobResult : CosDataResult
13 | {
14 | ///
15 | /// 音频审核结果
16 | ///
17 | ///
18 | public AudioCensorResult resultStruct {
19 | get {return _data; }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/GetVideoCensorJobResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using COSXML.Model.Tag;
5 | using COSXML.Transfer;
6 |
7 | namespace COSXML.Model.CI
8 | {
9 | ///
10 | /// 视频审核结果
11 | ///
12 | public sealed class GetVideoCensorJobResult : CosDataResult
13 | {
14 | ///
15 | /// 视频审核结果
16 | ///
17 | ///
18 | public VideoCensorResult resultStruct {
19 | get {return _data; }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/SubmitCensorJobResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using COSXML.Model.Tag;
5 | using COSXML.Transfer;
6 |
7 | namespace COSXML.Model.CI
8 | {
9 | ///
10 | ///
11 | ///
12 | public sealed class SubmitCensorJobResult : CosDataResult
13 | {
14 |
15 | ///
16 | /// 图片审核结果
17 | ///
18 | ///
19 | public CensorJobsResponse censorJobsResponse {
20 | get {return _data; }
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXMLTests/Utils/ResponseTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using COSXML.Network;
3 | using NUnit.Framework;
4 |
5 | namespace COSXML.Utils.Tests;
6 | [TestFixture]
7 | public class ResponseTest
8 | {
9 |
10 |
11 | [Test]
12 | public void HandleResponseHeader_IsCalled()
13 | {
14 | var response = new Response();
15 | response.HandleResponseHeader();
16 |
17 | }
18 |
19 | [Test]
20 | public void OnFinish_IsCalled()
21 | {
22 | var response = new Response();
23 | var exception = new Exception();
24 | response.OnFinish(true,exception);
25 | }
26 | }
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/DoesBucketExistRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Bucket
8 | {
9 | ///
10 | /// 检索 Bucket 是否存在
11 | ///
12 | ///
13 | public sealed class DoesBucketExistRequest : BucketRequest
14 | {
15 | public DoesBucketExistRequest(string bucket)
16 | : base(bucket)
17 | {
18 | this.method = CosRequestMethod.HEAD;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/GetDocumentCensorJobResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using COSXML.Model.Tag;
5 | using COSXML.Transfer;
6 |
7 | namespace COSXML.Model.CI
8 | {
9 | ///
10 | /// 文档审核结果
11 | ///
12 | public sealed class GetDocumentCensorJobResult : CosDataResult
13 | {
14 | ///
15 | /// 文档审核结果
16 | ///
17 | ///
18 | public DocumentCensorResult resultStruct {
19 | get {return _data; }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/ImageProcessResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using COSXML.Model.Tag;
5 | using COSXML.Transfer;
6 |
7 | namespace COSXML.Model.CI
8 | {
9 | ///
10 | /// 图片处理结果
11 | ///
12 | public sealed class ImageProcessResult : CosDataResult
13 | {
14 |
15 | ///
16 | /// 图片处理结果
17 | ///
18 | ///
19 | public PicOperationUploadResult uploadResult {
20 | get {return _data; }
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/QRCodeRecognitionResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using COSXML.Model.Tag;
5 | using COSXML.Transfer;
6 |
7 | namespace COSXML.Model.CI
8 | {
9 | ///
10 | /// 二维码识别结果
11 | ///
12 | public sealed class QRCodeRecognitionResult : CosDataResult
13 | {
14 |
15 | ///
16 | /// 二维码识别结果
17 | ///
18 | ///
19 | public QRRecognitionResult recognitionResult {
20 | get {return _data; }
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/SubmitTextCensorJobResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using COSXML.Model.Tag;
5 | using COSXML.Transfer;
6 |
7 | namespace COSXML.Model.CI
8 | {
9 | ///
10 | ///
11 | ///
12 | public sealed class SubmitTextCensorJobsResult : CosDataResult
13 | {
14 |
15 | ///
16 | /// 文本审核结果
17 | ///
18 | ///
19 | public TextCensorJobsResponse textCensorJobsResponse {
20 | get {return _data; }
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/SelectObject.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Xml.Serialization;
3 |
4 | namespace COSXML.Model.Tag
5 | {
6 | [XmlRoot("SelectRequest")]
7 | public sealed class SelectObject
8 | {
9 |
10 | [XmlElement("Expression")]
11 | public string Expression;
12 |
13 | [XmlElement("ExpressionType")]
14 | public string ExpressionType;
15 |
16 | [XmlElement("InputSerialization")]
17 | public ObjectSelectionFormat InputFormat;
18 |
19 | [XmlElement("OutputSerialization")]
20 | public ObjectSelectionFormat OutputFormat;
21 | }
22 | }
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Utils/EnumUtils.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Utils
7 | {
8 | public static class EnumUtils
9 | {
10 | public static string GetValue(Enum value)
11 | {
12 | string name = value.ToString();
13 |
14 | var fieldInfo = value.GetType().GetField(name);
15 |
16 | var attributes = fieldInfo.GetCustomAttributes(typeof(CosValueAttribute), false);
17 |
18 | return attributes != null && attributes.Length > 0 ? ((CosValueAttribute)attributes[0]).Value : name;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/SensitiveContentRecognitionResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Collections.Generic;
4 | using COSXML.Model.Tag;
5 | using COSXML.Transfer;
6 |
7 | namespace COSXML.Model.CI
8 | {
9 | ///
10 | /// 图片审核结果
11 | ///
12 | public sealed class SensitiveContentRecognitionResult : CosDataResult
13 | {
14 |
15 | ///
16 | /// 图片审核结果
17 | ///
18 | ///
19 | public SensitiveRecognitionResult recognitionResult {
20 | get {return _data; }
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Common/CosACL.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Utils;
6 |
7 | namespace COSXML.Common
8 | {
9 | public enum CosACL
10 | {
11 | ///
12 | /// 私有读写
13 | ///
14 | [CosValue("private")]
15 | Private = 0,
16 |
17 | ///
18 | /// 私有写公有读
19 | ///
20 | [CosValue("public-read")]
21 | PublicRead,
22 |
23 | ///
24 | /// 公有读写
25 | ///
26 | [CosValue("public-read-write")]
27 | PublicReadWrite,
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/DeleteBucketCORSRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Bucket
8 | {
9 | ///
10 | /// 删除 Bucket CORS
11 | ///
12 | ///
13 | public sealed class DeleteBucketCORSRequest : BucketRequest
14 | {
15 | public DeleteBucketCORSRequest(string bucket) : base(bucket)
16 | {
17 | this.method = CosRequestMethod.DELETE;
18 | this.queryParameters.Add("cors", null);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketACLRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Bucket
8 | {
9 | ///
10 | /// 获取 Bucket 的访问权限控制列表
11 | ///
12 | ///
13 | public sealed class GetBucketACLRequest : BucketRequest
14 | {
15 | public GetBucketACLRequest(string bucket)
16 | : base(bucket)
17 | {
18 | this.method = CosRequestMethod.GET;
19 | this.queryParameters.Add("acl", null);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketPolicyRequest.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Common;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | ///
9 | /// 获取 Bucket 权限策略
10 | ///
11 | ///
12 | public sealed class GetBucketPolicyRequest : BucketRequest
13 | {
14 | public GetBucketPolicyRequest(string bucket)
15 | : base(bucket)
16 | {
17 | this.method = CosRequestMethod.GET;
18 | this.queryParameters.Add("policy", null);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketCORSRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Bucket
8 | {
9 | ///
10 | /// 获取 Bucket CORS 配置信息
11 | ///
12 | ///
13 | public sealed class GetBucketCORSRequest : BucketRequest
14 | {
15 | public GetBucketCORSRequest(string bucket)
16 | : base(bucket)
17 | {
18 | this.method = CosRequestMethod.GET;
19 | this.queryParameters.Add("cors", null);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/DeleteBucketPolicyRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using COSXML.Common;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | ///
9 | /// 删除 Bucket 权限策略
10 | ///
11 | ///
12 | public sealed class DeleteBucketPolicyRequest : BucketRequest
13 | {
14 | public DeleteBucketPolicyRequest(string bucket)
15 | : base(bucket)
16 | {
17 | this.method = CosRequestMethod.DELETE;
18 | this.queryParameters.Add("policy", null);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Common/CosGrantPermission.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Utils;
7 |
8 | namespace COSXML.Common
9 | {
10 | public enum CosGrantPermission
11 | {
12 | ///
13 | /// 只读权限
14 | ///
15 | [CosValue("READ")]
16 | Read = 0,
17 |
18 | ///
19 | /// 只写权限
20 | ///
21 | [CosValue("WRITE")]
22 | Write,
23 |
24 | ///
25 | /// 读写权限
26 | ///
27 | [CosValue("FULL_CONTROL")]
28 | FullControl
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketRefererRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Bucket
8 | {
9 | ///
10 | /// 查询 Bucket 的防盗链配置
11 | ///
12 | ///
13 | public sealed class GetBucketRefererRequest : BucketRequest
14 | {
15 | public GetBucketRefererRequest(string bucket)
16 | : base(bucket)
17 | {
18 | this.method = CosRequestMethod.GET;
19 | this.queryParameters.Add("referer", null);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/GetObjectACLRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Object
8 | {
9 | ///
10 | /// 获取某个存储桶下的某个对象的访问权限
11 | ///
12 | ///
13 | public sealed class GetObjectACLRequest : ObjectRequest
14 | {
15 | public GetObjectACLRequest(string bucket, string key)
16 | : base(bucket, key)
17 | {
18 | this.method = CosRequestMethod.GET;
19 | this.queryParameters.Add("acl", null);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/VersioningConfiguration.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Serialization;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Tag
7 | {
8 | [XmlRoot]
9 | public sealed class VersioningConfiguration
10 | {
11 | [XmlElement("Status")]
12 | public string status;
13 |
14 | public string GetInfo()
15 | {
16 | StringBuilder stringBuilder = new StringBuilder("{VersioningConfiguration:\n");
17 |
18 | stringBuilder.Append("Status:").Append(status).Append("\n");
19 | stringBuilder.Append("}");
20 |
21 | return stringBuilder.ToString();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketLifecycleRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Bucket
8 | {
9 | ///
10 | /// 查询 Bucket 的生命周期配置
11 | ///
12 | ///
13 | public sealed class GetBucketLifecycleRequest : BucketRequest
14 | {
15 | public GetBucketLifecycleRequest(string bucket)
16 | : base(bucket)
17 | {
18 | this.method = CosRequestMethod.GET;
19 | this.queryParameters.Add("lifecycle", null);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/Delete.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Xml.Serialization;
4 |
5 | using System.Text;
6 |
7 | namespace COSXML.Model.Tag
8 | {
9 | [XmlRoot("Delete")]
10 | public sealed class Delete
11 | {
12 | [XmlElement("Quiet")]
13 | public bool quiet;
14 |
15 | [XmlElement("Object")]
16 | public List deleteObjects;
17 |
18 | public sealed class DeleteObject
19 | {
20 |
21 | [XmlElement("Key")]
22 | public string key;
23 |
24 | [XmlElement("VersionId")]
25 | public string versionId;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Common/CosStorageClass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Utils;
7 |
8 | namespace COSXML.Common
9 | {
10 | public enum CosStorageClass
11 | {
12 | ///
13 | /// 标准储存
14 | ///
15 | [CosValue("Standard")]
16 | Standard = 0,
17 |
18 | ///
19 | /// 低频存储
20 | ///
21 | [CosValue("Standard_IA")]
22 | StandardIA = 1,
23 |
24 | ///
25 | /// 归档储存
26 | ///
27 | [CosValue("ARCHIVE")]
28 | Archive
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/QRCodeRecognitionRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Model.Object;
7 | using COSXML.CosException;
8 |
9 | namespace COSXML.Model.CI
10 | {
11 | public sealed class QRCodeRecognitionRequest : ObjectRequest
12 | {
13 | public QRCodeRecognitionRequest(string bucket, string key, int cover)
14 | : base(bucket, key)
15 | {
16 | this.method = CosRequestMethod.GET;
17 | this.queryParameters.Add("ci-process", "QRcode");
18 | this.queryParameters.Add("cover", cover.ToString());
19 | }
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/DomainConfiguration.cs:
--------------------------------------------------------------------------------
1 | using System.Xml.Serialization;
2 |
3 | namespace COSXML.Model.Tag
4 | {
5 | [XmlRoot("DomainConfiguration")]
6 | public sealed class DomainConfiguration
7 | {
8 | [XmlElement("DomainRule")]
9 | public DomainRule rule;
10 |
11 | public sealed class DomainRule
12 | {
13 | [XmlElement]
14 | public string Name;
15 |
16 | [XmlElement]
17 | public string Status;
18 |
19 | [XmlElement]
20 | public string Type;
21 |
22 | [XmlElement("ForcedReplacement")]
23 | public string Replace;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/ListDocProcessDetail.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Xml.Serialization;
4 |
5 | namespace COSXML.Model.Tag
6 | {
7 | ///
8 | /// 拉取符合条件的文档转码任务返回https://cloud.tencent.com/document/product/460/46944
9 | ///
10 | [XmlRoot("Response")]
11 | public sealed class ListDocProcessResponse
12 | {
13 | ///
14 | /// 任务的详细信息
15 | ///
16 | [XmlElement("JobsDetail")]
17 | // [XmlArrayItem("JobsDetail")]
18 | public List JobsDetail;
19 | [XmlElement]
20 | public String NextToken;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/DeleteBucketLifecycleRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Bucket
8 | {
9 | ///
10 | /// 删除 Bucket Lifecycle
11 | ///
12 | ///
13 | public sealed class DeleteBucketLifecycleRequest : BucketRequest
14 | {
15 | public DeleteBucketLifecycleRequest(string bucket)
16 | : base(bucket)
17 | {
18 | this.method = CosRequestMethod.DELETE;
19 | this.queryParameters.Add("lifecycle", null);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/CopyObjectResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 |
8 | namespace COSXML.Model.Object
9 | {
10 | ///
11 | /// 复制对象返回的结果
12 | ///
13 | ///
14 | public sealed class CopyObjectResult : CosDataResult
15 | {
16 | ///
17 | /// 复制结果信息
18 | ///
19 | ///
20 | public CopyObject copyObject {
21 | get {return _data; }
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/GetObjectTaggingResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 |
8 | namespace COSXML.Model.Object
9 | {
10 | ///
11 | /// 获取存储桶下某个对象的标签结果
12 | ///
13 | ///
14 | public sealed class GetObjectTaggingResult : CosDataResult
15 | {
16 | ///
17 | /// 对象标签内容
18 | ///
19 | ///
20 | public Tagging tagging {
21 | get {return _data; }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/ListPartsResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 |
8 | namespace COSXML.Model.Object
9 | {
10 | ///
11 | /// 查询特定分块上传中的已上传的块返回的结果
12 | ///
13 | ///
14 | public sealed class ListPartsResult : CosDataResult
15 | {
16 | ///
17 | /// 已上传块的所有信息
18 | ///
19 | ///
20 | public ListParts listParts {
21 | get {return _data; }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/UploadPartCopyResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 |
8 | namespace COSXML.Model.Object
9 | {
10 | ///
11 | /// 分片复制返回的结果
12 | ///
13 | ///
14 | public sealed class UploadPartCopyResult : CosDataResult
15 | {
16 | ///
17 | /// 分片复制的结果信息
18 | ///
19 | ///
20 | public CopyPartResult copyPart {
21 | get {return _data; }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/DeleteMultiObjectResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 |
8 | namespace COSXML.Model.Object
9 | {
10 | ///
11 | /// 批量删除 Object返回的结果
12 | ///
13 | ///
14 | public sealed class DeleteMultiObjectResult : CosDataResult
15 | {
16 | ///
17 | /// 本次删除返回结果的方式和目标 Object
18 | ///
19 | ///
20 | public DeleteResult deleteResult {
21 | get {return _data; }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketInventoryRequest.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Common;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | public sealed class GetBucketInventoryRequest : BucketRequest
9 | {
10 | public GetBucketInventoryRequest(string bucket) : base(bucket)
11 | {
12 | this.method = CosRequestMethod.GET;
13 | this.queryParameters.Add("inventory", null);
14 | }
15 |
16 | public void SetInventoryId(string inventoryId)
17 | {
18 |
19 | if (inventoryId != null)
20 | {
21 | SetQueryParameter("id", inventoryId);
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/CompleteMultipartUploadResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 |
8 | namespace COSXML.Model.Object
9 | {
10 | ///
11 | /// 完成整个分块上传返回的结果
12 | ///
13 | ///
14 | public sealed class CompleteMultipartUploadResult : CosDataResult
15 | {
16 | ///
17 | /// Complete返回信息
18 | ///
19 | ///
20 | public CompleteResult completeResult {
21 | get {return _data; }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/GetObjectACLResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 |
8 | namespace COSXML.Model.Object
9 | {
10 | ///
11 | /// 获取某个存储桶下的某个对象的访问权限的返回结果
12 | ///
13 | ///
14 | public sealed class GetObjectACLResult : CosDataResult
15 | {
16 | ///
17 | /// 访问权限信息
18 | ///
19 | ///
20 | public AccessControlPolicy accessControlPolicy {
21 | get {return _data; }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 | using System.IO;
8 |
9 | namespace COSXML.Model.Bucket
10 | {
11 | ///
12 | /// 获取 Bucket 对象列表返回的jieguo
13 | ///
14 | ///
15 | public sealed class GetBucketResult : CosDataResult
16 | {
17 | ///
18 | /// 保存 Get Bucket 请求结果的所有信息
19 | ///
20 | ///
21 | public ListBucket listBucket {
22 | get{ return _data; }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/GetMediaInfoRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using System.IO;
6 | using COSXML.Common;
7 | using COSXML.Model.Object;
8 | using COSXML.CosException;
9 |
10 | namespace COSXML.Model.CI
11 | {
12 | ///
13 | /// 获取媒体信息
14 | ///
15 | ///
16 | public sealed class GetMediaInfoRequest : ObjectRequest
17 | {
18 | public GetMediaInfoRequest(string bucket, string key)
19 | : base(bucket, key)
20 | {
21 | this.method = CosRequestMethod.GET;
22 | this.queryParameters.Add("ci-process", "videoinfo");
23 | }
24 |
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/InitMultipartUploadResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 |
8 | namespace COSXML.Model.Object
9 | {
10 | ///
11 | /// 实现初始化分片上传返回的结果
12 | ///
13 | ///
14 | public sealed class InitMultipartUploadResult : CosDataResult
15 | {
16 | ///
17 | /// 返回信息
18 | ///
19 | ///
20 | public InitiateMultipartUpload initMultipartUpload {
21 | get {return _data;}
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/DeleteBucketInventoryRequest.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Common;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | public sealed class DeleteBucketInventoryRequest : BucketRequest
9 | {
10 | public DeleteBucketInventoryRequest(string bucket) : base(bucket)
11 | {
12 | this.method = CosRequestMethod.DELETE;
13 | this.queryParameters.Add("inventory", null);
14 | }
15 |
16 | public void SetInventoryId(string inventoryId)
17 | {
18 |
19 | if (inventoryId != null)
20 | {
21 | SetQueryParameter("id", inventoryId);
22 | }
23 | }
24 |
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketCORSResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 |
8 | namespace COSXML.Model.Bucket
9 | {
10 | ///
11 | /// 获取 Bucket CORS 返回的结果
12 | ///
13 | ///
14 | public class GetBucketCORSResult : CosDataResult
15 | {
16 | ///
17 | /// 跨域资源共享配置的所有信息,最多可以包含100条 CORSRule
18 | ///
19 | ///
20 | public CORSConfiguration corsConfiguration {
21 | get{ return _data; }
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketIntelligentTieringRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using System.Text;
4 | using COSXML.Common;
5 | using COSXML.Model.Tag;
6 | using COSXML.Network;
7 | using COSXML.CosException;
8 |
9 | namespace COSXML.Model.Bucket
10 | {
11 | ///
12 | /// 设置 Bucket 生命周期
13 | ///
14 | ///
15 | public sealed class GetBucketIntelligentTieringRequest : BucketRequest
16 | {
17 |
18 | public GetBucketIntelligentTieringRequest(string bucket)
19 | : base(bucket)
20 | {
21 | this.method = CosRequestMethod.GET;
22 | this.queryParameters.Add("intelligenttiering", null);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/ListMultiUploadsResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Transfer;
6 | using COSXML.Model.Tag;
7 |
8 | namespace COSXML.Model.Bucket
9 | {
10 | ///
11 | /// 查询 Bucket 正在进行中的分块上传返回的结果
12 | ///
13 | ///
14 | public sealed class ListMultiUploadsResult : CosDataResult
15 | {
16 | ///
17 | /// 所有分块上传的信息
18 | ///
19 | ///
20 | public ListMultipartUploads listMultipartUploads {
21 | get {return _data; }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/CopyPartResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Serialization;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Tag
7 | {
8 | ///
9 | /// 复制结果返回信息
10 | ///
11 | ///
12 | [XmlRoot("CopyPartResult")]
13 | public sealed class CopyPartResult
14 | {
15 | ///
16 | /// 返回文件的 MD5 算法校验值。ETag 的值可以用于检查 Object 的内容是否发生变化
17 | ///
18 | [XmlElement("ETag")]
19 | public string eTag;
20 |
21 | ///
22 | /// 返回文件最后修改时间,GMT 格式
23 | ///
24 | [XmlElement("LastModified")]
25 | public string lastModified;
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketACLResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using System.IO;
7 | using COSXML.Transfer;
8 |
9 | namespace COSXML.Model.Bucket
10 | {
11 | ///
12 | /// 获取 Bucket 访问权限列表返回的结果
13 | ///
14 | ///
15 | public sealed class GetBucketACLResult : CosDataResult
16 | {
17 | ///
18 | /// 访问权限列表信息
19 | ///
20 | ///
21 | public AccessControlPolicy accessControlPolicy {
22 | get{ return _data; }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketLifecycleResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 |
8 | namespace COSXML.Model.Bucket
9 | {
10 | ///
11 | /// 查询 Bucket 的生命周期配置 返回的结果
12 | ///
13 | ///
14 | public sealed class GetBucketLifecycleResult : CosDataResult
15 | {
16 | ///
17 | /// 生命周期配置信息
18 | ///
19 | ///
20 | public LifecycleConfiguration lifecycleConfiguration {
21 | get{ return _data; }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Service/GetServiceResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 | using System.IO;
8 |
9 | namespace COSXML.Model.Service
10 | {
11 | ///
12 | /// 获取所有 Bucket 列表返回的结果
13 | ///
14 | ///
15 | public sealed class GetServiceResult : CosDataResult
16 | {
17 | ///
18 | /// list all buckets for users
19 | ///
20 | ///
21 | public ListAllMyBuckets listAllMyBuckets {
22 | get {return _data; }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Transfer/XmlParse.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Model.Tag;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Xml;
6 | using System.Xml.Serialization;
7 |
8 | namespace COSXML.Transfer
9 | {
10 | public sealed class XmlParse
11 | {
12 | public static T Deserialize(Stream inStream)
13 | {
14 | using (inStream)
15 | {
16 | using (XmlTextReader reader = new XmlTextReader(inStream))
17 | {
18 | reader.Namespaces = false;
19 | XmlSerializer serializer = new XmlSerializer(typeof(T));
20 | return (T) serializer.Deserialize(reader);
21 | }
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/GetTextCensorJobRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Model.Object;
7 | using COSXML.Model.Tag;
8 | using COSXML.CosException;
9 | using COSXML.Utils;
10 |
11 | namespace COSXML.Model.CI
12 | {
13 | ///
14 | /// 查询文本审核任务
15 | ///
16 | ///
17 | public sealed class GetTextCensorJobRequest : CIRequest
18 | {
19 | public GetTextCensorJobRequest(string bucket, string JobId)
20 | : base(bucket)
21 | {
22 | this.method = CosRequestMethod.GET;
23 | this.SetRequestPath("/text/auditing/" + JobId);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/GetAudioCensorJobRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Model.Object;
7 | using COSXML.Model.Tag;
8 | using COSXML.CosException;
9 | using COSXML.Utils;
10 |
11 | namespace COSXML.Model.CI
12 | {
13 | ///
14 | /// 查询音频审核任务
15 | ///
16 | ///
17 | public sealed class GetAudioCensorJobRequest : CIRequest
18 | {
19 | public GetAudioCensorJobRequest(string bucket, string JobId)
20 | : base(bucket)
21 | {
22 | this.method = CosRequestMethod.GET;
23 | this.SetRequestPath("/audio/auditing/" + JobId);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/GetVideoCensorJobRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Model.Object;
7 | using COSXML.Model.Tag;
8 | using COSXML.CosException;
9 | using COSXML.Utils;
10 |
11 | namespace COSXML.Model.CI
12 | {
13 | ///
14 | /// 查询视频审核任务
15 | ///
16 | ///
17 | public sealed class GetVideoCensorJobRequest : CIRequest
18 | {
19 | public GetVideoCensorJobRequest(string bucket, string JobId)
20 | : base(bucket)
21 | {
22 | this.method = CosRequestMethod.GET;
23 | this.SetRequestPath("/video/auditing/" + JobId);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/GetDocumentCensorJobRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Model.Object;
7 | using COSXML.Model.Tag;
8 | using COSXML.CosException;
9 | using COSXML.Utils;
10 |
11 | namespace COSXML.Model.CI
12 | {
13 | ///
14 | /// 查询文档审核任务
15 | ///
16 | ///
17 | public sealed class GetDocumentCensorJobRequest : CIRequest
18 | {
19 | public GetDocumentCensorJobRequest(string bucket, string JobId)
20 | : base(bucket)
21 | {
22 | this.method = CosRequestMethod.GET;
23 | this.SetRequestPath("/document/auditing/" + JobId);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/DescribeDocProcessJobResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Model.Object;
7 | using COSXML.Model.Tag;
8 | using COSXML.CosException;
9 | using COSXML.Utils;
10 |
11 | namespace COSXML.Model.CI
12 | {
13 | ///
14 | /// 查询指定的文档转码任务
15 | ///
16 | ///
17 | public sealed class DescribeDocProcessJobResult : CosDataResult
18 | {
19 |
20 | ///
21 | /// 文档转码结果
22 | ///
23 | ///
24 | public DocProcessResponse taskDocProcessResult
25 | {
26 | get { return _data; }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/CensorJobDetail.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Xml.Serialization;
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Tag
7 | {
8 | ///
9 | /// 审核任务提交回执
10 | ///
11 | ///
12 | [XmlRoot("Response")]
13 | public sealed class CensorJobsResponse
14 | {
15 | [XmlElement]
16 | public JobsDetailContent JobsDetail;
17 |
18 | public sealed class JobsDetailContent
19 | {
20 | [XmlElement]
21 | public string JobId;
22 |
23 | [XmlElement]
24 | public string State;
25 |
26 | [XmlElement]
27 | public string CreationTime;
28 | }
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/DescribeDocProcessJobsResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Model.Object;
7 | using COSXML.Model.Tag;
8 | using COSXML.CosException;
9 | using COSXML.Utils;
10 |
11 | namespace COSXML.Model.CI
12 | {
13 | ///
14 | /// 拉取符合条件的文档转码任务
15 | ///
16 | ///
17 | public sealed class DescribeDocProcessJobsResult : CosDataResult
18 | {
19 |
20 | ///
21 | /// 文档转码结果
22 | ///
23 | ///
24 | public ListDocProcessResponse listDocProcessResult
25 | {
26 | get { return _data; }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/ListBucketInventoryRequest.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Common;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Bucket
7 | {
8 | public sealed class ListBucketInventoryRequest : BucketRequest
9 | {
10 | private String continuationToken;
11 |
12 | public ListBucketInventoryRequest(string bucket) : base(bucket)
13 | {
14 | this.method = CosRequestMethod.GET;
15 | this.queryParameters.Add("inventory", null);
16 | }
17 |
18 | public void SetContinuationToken(String continuationToken)
19 | {
20 |
21 | if (continuationToken != null)
22 | {
23 | SetQueryParameter("continuation-token", continuationToken);
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/UploadPartResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using System.IO;
6 |
7 | namespace COSXML.Model.Object
8 | {
9 | ///
10 | /// 分片上传返回的结果
11 | ///
12 | ///
13 | public sealed class UploadPartResult : CosResult
14 | {
15 | ///
16 | /// 分片块的eTag
17 | ///
18 | public string eTag;
19 |
20 | internal override void InternalParseResponseHeaders()
21 | {
22 | List values;
23 |
24 | this.responseHeaders.TryGetValue("ETag", out values);
25 |
26 | if (values != null && values.Count > 0)
27 | {
28 | eTag = values[0];
29 | }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/DescribeDocProcessJobRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Model.Object;
7 | using COSXML.Model.Tag;
8 | using COSXML.CosException;
9 | using COSXML.Utils;
10 |
11 | namespace COSXML.Model.CI
12 | {
13 | ///
14 | /// 查询指定的文档转码任务
15 | ///
16 | ///
17 | public sealed class DescribeDocProcessJobRequest : CIRequest
18 | {
19 | public DescribeDocProcessJobRequest(string bucket,string jobId)
20 | : base(bucket)
21 | {
22 | this.method = CosRequestMethod.GET;
23 | this.SetRequestPath("/doc_jobs/" + jobId);
24 | this.SetRequestHeader("Content-Type", "application/xml");
25 |
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/ImageProcessRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Model.Object;
7 | using COSXML.CosException;
8 |
9 | namespace COSXML.Model.CI
10 | {
11 | public sealed class ImageProcessRequest : ObjectRequest
12 | {
13 | public ImageProcessRequest(string bucket, string key, string operationRules)
14 | : base(bucket, key)
15 | {
16 |
17 | if (operationRules == null)
18 | {
19 | throw new CosClientException((int)CosClientError.InvalidArgument, "operationRules = null");
20 | }
21 |
22 | this.method = CosRequestMethod.POST;
23 | this.queryParameters.Add("image_process", null);
24 | this.headers.Add("Pic-Operations", operationRules);
25 | }
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/DescribeFileZipProcessJobsRequest.cs:
--------------------------------------------------------------------------------
1 | // Create by COSSDKTOOLS;
2 |
3 | using System;
4 | using System.Collections.Generic;
5 |
6 | using System.Text;
7 | using COSXML.Common;
8 | using COSXML.Model.Object;
9 | using COSXML.Model.CI;
10 | using COSXML.CosException;
11 | using COSXML.Utils;
12 |
13 | namespace COSXML.Model.CI
14 | {
15 | ///
16 | /// 本接口用于主动查询指定的多文件打包压缩任务结果
17 | ///
18 | ///
19 | public sealed class DescribeFileZipProcessJobsRequest : CIRequest
20 | {
21 |
22 |
23 | public DescribeFileZipProcessJobsRequest(string bucket, string jobId)
24 | : base(bucket)
25 | {
26 | this.method = CosRequestMethod.GET;
27 | this.SetRequestPath("/"+"jobs"+"/"+jobId);
28 | }
29 |
30 |
31 |
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/DescribeFileZipProcessJobsResult.cs:
--------------------------------------------------------------------------------
1 | // Create by COSSDKTOOLS;
2 |
3 | using System;
4 | using System.Collections.Generic;
5 |
6 | using System.Text;
7 | using COSXML.Common;
8 | using COSXML.Model.Object;
9 | using COSXML.Model.Tag;
10 | using COSXML.CosException;
11 | using COSXML.Utils;
12 |
13 | namespace COSXML.Model.CI
14 | {
15 | ///
16 | /// 本接口用于主动查询指定的多文件打包压缩任务结果
17 | ///
18 | ///
19 | public sealed class DescribeFileZipProcessJobsResult : CosDataResult
20 | {
21 |
22 | ///
23 | /// 本接口用于主动查询指定的多文件打包压缩任务结果 结果
24 | ///
25 | ///
26 | public DescribeFileZipProcessJobsResponse describeFileZipProcessJobsResult
27 | {
28 | get { return _data; }
29 | }
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketDomainRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 |
4 | using COSXML.Common;
5 | using COSXML.Model.Tag;
6 | using COSXML.Network;
7 |
8 | namespace COSXML.Model.Bucket
9 | {
10 | ///
11 | /// 检索 Bucket 是否存在
12 | ///
13 | ///
14 | public sealed class PutBucketDomainRequest : BucketRequest
15 | {
16 | private DomainConfiguration domain;
17 |
18 | public PutBucketDomainRequest(string bucket, DomainConfiguration domain)
19 | : base(bucket)
20 | {
21 | this.method = CosRequestMethod.PUT;
22 | this.domain = domain;
23 | this.queryParameters.Add("domain", null);
24 | }
25 |
26 | public override Network.RequestBody GetRequestBody()
27 | {
28 | return GetXmlRequestBody(domain);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/COSXML.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "COSXML", "COSXML.csproj", "{2EAC00B4-2C14-491A-AEEE-8953D8A83EBF}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {2EAC00B4-2C14-491A-AEEE-8953D8A83EBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {2EAC00B4-2C14-491A-AEEE-8953D8A83EBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {2EAC00B4-2C14-491A-AEEE-8953D8A83EBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {2EAC00B4-2C14-491A-AEEE-8953D8A83EBF}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/CosException/CosClientException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Runtime.Serialization;
4 | using System.Text;
5 |
6 | namespace COSXML.CosException
7 | {
8 | ///
9 | /// 客户端异常,通常是指没有收到服务器响应的异常,比如网络异常、本地 IO 异常等。
10 | ///
11 | [Serializable]
12 | public class CosClientException : System.ApplicationException
13 | {
14 | ///
15 | /// 错误码
16 | ///
17 | ///
18 | public int errorCode;
19 |
20 | public CosClientException(int errorCode, string message)
21 | : base(message)
22 | {
23 | this.errorCode = errorCode;
24 | }
25 |
26 | public CosClientException(int errorCode, string message, Exception cause)
27 | : base(message, cause)
28 | {
29 | this.errorCode = errorCode;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/DeleteObjectRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Object
8 | {
9 | ///
10 | /// 删除对象
11 | ///
12 | ///
13 | public sealed class DeleteObjectRequest : ObjectRequest
14 | {
15 | public DeleteObjectRequest(string bucket, string key)
16 | : base(bucket, key)
17 | {
18 | this.method = CosRequestMethod.DELETE;
19 | }
20 |
21 | ///
22 | /// 删除指定版本的对象
23 | ///
24 | ///
25 | public void SetVersionId(string versionId)
26 | {
27 |
28 | if (versionId != null)
29 | {
30 | SetQueryParameter(CosRequestHeaderKey.VERSION_ID, versionId);
31 | }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/InitiateMultipartUpload.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Xml.Serialization;
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Tag
7 | {
8 | ///
9 | /// 初始化上传返回的信息
10 | ///
11 | ///
12 | [XmlRoot("InitiateMultipartUploadResult")]
13 | public sealed class InitiateMultipartUpload
14 | {
15 | ///
16 | /// 分片上传的目标 Bucket,由用户自定义字符串和系统生成appid数字串由中划线连接而成,如:mybucket-1250000000.
17 | ///
18 | [XmlElement("Bucket")]
19 | public string bucket;
20 |
21 | ///
22 | /// Object 的名称
23 | ///
24 | [XmlElement("Key")]
25 | public string key;
26 |
27 | ///
28 | /// 在后续上传中使用的 ID
29 | ///
30 | [XmlElement("UploadId")]
31 | public string uploadId;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/HeadObjectRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Object
8 | {
9 | ///
10 | /// 检索 对象 的 meta 信息数据
11 | ///
12 | ///
13 | public sealed class HeadObjectRequest : ObjectRequest
14 | {
15 | public HeadObjectRequest(string bucket, string key)
16 | : base(bucket, key)
17 | {
18 | this.method = CosRequestMethod.HEAD;
19 | }
20 |
21 | ///
22 | /// 特定版本的对象
23 | ///
24 | ///
25 | public void SetVersionId(string versionId)
26 | {
27 |
28 | if (versionId != null)
29 | {
30 | SetQueryParameter(CosRequestHeaderKey.VERSION_ID, versionId);
31 | }
32 | }
33 |
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/DoesObjectExistRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Object
8 | {
9 | ///
10 | /// 检查对象是否存在, 封装了Head接口
11 | ///
12 | ///
13 | public sealed class DoesObjectExistRequest : ObjectRequest
14 | {
15 | public DoesObjectExistRequest(string bucket, string key)
16 | : base(bucket, key)
17 | {
18 | this.method = CosRequestMethod.HEAD;
19 | }
20 |
21 | ///
22 | /// 特定版本的对象
23 | ///
24 | ///
25 | public void SetVersionId(string versionId)
26 | {
27 |
28 | if (versionId != null)
29 | {
30 | SetQueryParameter(CosRequestHeaderKey.VERSION_ID, versionId);
31 | }
32 | }
33 |
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Network/Response.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using System.IO;
6 |
7 | namespace COSXML.Network
8 | {
9 | public class Response
10 | {
11 |
12 | public int Code { get; set; }
13 |
14 | public string Message { get; set; }
15 |
16 | public Dictionary> Headers { get; set; }
17 |
18 | public long ContentLength { get; set; }
19 |
20 | public string ContentType { get; set; }
21 |
22 | public ResponseBody Body { get; set; }
23 |
24 | public virtual void HandleResponseHeader()
25 | {
26 |
27 | }
28 |
29 | ///
30 | /// handle body successfully or throw exception
31 | ///
32 | ///
33 | ///
34 | public virtual void OnFinish(bool isSuccess, Exception ex)
35 | {
36 |
37 | }
38 |
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXMLTests/COSXMLTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6
5 | false
6 | 00:45:00
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | runtime; build; native; contentfiles; analyzers; buildtransitive
17 | all
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/CreateFileZipProcessJobsResult.cs:
--------------------------------------------------------------------------------
1 | // Create by COSSDKTOOLS;
2 |
3 | using System;
4 | using System.Collections.Generic;
5 |
6 | using System.Text;
7 | using COSXML.Common;
8 | using COSXML.Model.Object;
9 | using COSXML.Model.Tag;
10 | using COSXML.CosException;
11 | using COSXML.Utils;
12 |
13 | namespace COSXML.Model.CI
14 | {
15 | ///
16 | /// 多文件打包压缩功能可以将您的多个文件,打包为 zip 等压缩包格式,以提交任务的方式进行多文件打包压缩,异步返回打包后的文件,该接口属于 POST 请求
17 | ///
18 | ///
19 | public sealed class CreateFileZipProcessJobsResult : CosDataResult
20 | {
21 |
22 | ///
23 | /// 多文件打包压缩功能可以将您的多个文件,打包为 zip 等压缩包格式,以提交任务的方式进行多文件打包压缩,异步返回打包后的文件,该接口属于 POST 请求 结果
24 | ///
25 | ///
26 | public CreateFileZipProcessJobsResponse createFileZipProcessJobsResult
27 | {
28 | get { return _data; }
29 | }
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Service/GetServiceRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Service
8 | {
9 | ///
10 | /// 获取所有 Bucket 列表
11 | ///
12 | ///
13 | public sealed class GetServiceRequest : CosRequest
14 | {
15 | public string host { get; set; }
16 |
17 | public GetServiceRequest()
18 | {
19 | method = CosRequestMethod.GET;
20 | path = "/";
21 | host = "service.cos.myqcloud.com";
22 | }
23 |
24 | public override string GetHost()
25 | {
26 |
27 | return host;
28 | }
29 |
30 | public override Network.RequestBody GetRequestBody()
31 | {
32 |
33 | return null;
34 | }
35 |
36 | public override void CheckParameters()
37 | {
38 |
39 | return;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/CompleteMultipartUpload.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Xml.Serialization;
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Tag
7 | {
8 | ///
9 | /// 本次分块上传的所有信息
10 | ///
11 | ///
12 | [XmlRoot]
13 | public sealed class CompleteMultipartUpload
14 | {
15 | ///
16 | /// 本次分块上传中每个块的信息
17 | ///
18 | ///
19 | [XmlElement("Part")]
20 | public List parts;
21 |
22 | public sealed class Part
23 | {
24 | ///
25 | /// 块编号
26 | ///
27 | [XmlElement("PartNumber")]
28 | public int partNumber;
29 |
30 | ///
31 | /// 每个块文件的 eTag 值
32 | ///
33 | [XmlElement("ETag")]
34 | public string eTag;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketPolicyRequest.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Common;
2 |
3 | namespace COSXML.Model.Bucket
4 | {
5 | ///
6 | /// 设置存储桶的策略
7 | /// https://cloud.tencent.com/document/product/436/8282
8 | ///
9 | public sealed class PutBucketPolicyRequest : BucketRequest
10 | {
11 | ///
12 | /// 存储桶权限策略,格式参考 https://cloud.tencent.com/document/product/436/8282
13 | ///
14 | private string bucketPolicy;
15 |
16 | public PutBucketPolicyRequest(string bucket)
17 | : base(bucket)
18 | {
19 | this.method = CosRequestMethod.PUT;
20 | this.queryParameters.Add("policy", null);
21 | }
22 |
23 | public override Network.RequestBody GetRequestBody()
24 | {
25 | return GetJsonRequestBody(bucketPolicy);
26 | }
27 |
28 | public void SetBucketPolicy(string bucketPolicyStr)
29 | {
30 | bucketPolicy = bucketPolicyStr;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketTaggingRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 |
4 | using COSXML.Common;
5 | using COSXML.Model.Tag;
6 | using COSXML.Network;
7 |
8 | namespace COSXML.Model.Bucket
9 | {
10 | ///
11 | /// 添加存储桶标签
12 | ///
13 | ///
14 | public sealed class PutBucketTaggingRequest : BucketRequest
15 | {
16 | private Tagging tagging;
17 |
18 | public PutBucketTaggingRequest(string bucket)
19 | : base(bucket)
20 | {
21 | this.method = CosRequestMethod.PUT;
22 | this.tagging = new Tagging();
23 | this.queryParameters.Add("tagging", null);
24 | }
25 |
26 | public void AddTag(string key, string value)
27 | {
28 | this.tagging.AddTag(key, value);
29 | }
30 |
31 |
32 | public override Network.RequestBody GetRequestBody()
33 | {
34 | return GetXmlRequestBody(tagging);
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Auth/QCloudCredentials.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace COSXML.Auth
6 | {
7 | public class QCloudCredentials
8 | {
9 | public QCloudCredentials(string secretId, string signKey, string keyTime)
10 | {
11 | this.SecretId = secretId;
12 | this.SignKey = signKey;
13 | this.KeyTime = keyTime;
14 | }
15 |
16 | public string SecretId
17 | { get; private set; }
18 |
19 | public string SignKey
20 | { get; private set; }
21 |
22 | public string KeyTime
23 | { get; private set; }
24 |
25 | }
26 |
27 | public class SessionQCloudCredentials : QCloudCredentials
28 | {
29 | public SessionQCloudCredentials(string secretId, string signKey, string token, string keyTime) :
30 | base(secretId, signKey, keyTime)
31 | {
32 | this.Token = token;
33 |
34 | }
35 |
36 | public string Token
37 | { get; private set; }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXMLTests/COSXMLTests.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.0.31903.59
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "COSXML-Netcore", "..\COSXML\COSXML-Netcore.csproj", "{FC694C68-F0E3-411F-8E6C-2E9F94826016}"
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(SolutionProperties) = preSolution
14 | HideSolutionNode = FALSE
15 | EndGlobalSection
16 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
17 | {FC694C68-F0E3-411F-8E6C-2E9F94826016}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
18 | {FC694C68-F0E3-411F-8E6C-2E9F94826016}.Debug|Any CPU.Build.0 = Debug|Any CPU
19 | {FC694C68-F0E3-411F-8E6C-2E9F94826016}.Release|Any CPU.ActiveCfg = Release|Any CPU
20 | {FC694C68-F0E3-411F-8E6C-2E9F94826016}.Release|Any CPU.Build.0 = Release|Any CPU
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Copyright (c) 2018 腾讯云
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | SOFTWARE.
21 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/AppendObjectResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using COSXML.Transfer;
7 |
8 | namespace COSXML.Model.Object
9 | {
10 | ///
11 | /// 使用Append接口的返回Result.
12 | ///
13 | public sealed class AppendObjectResult : CosResult
14 | {
15 | ///
16 | /// Append结果信息
17 | ///
18 | ///
19 | public long nextAppendPosition {get; set;}
20 |
21 | internal override void InternalParseResponseHeaders()
22 | {
23 | List values;
24 |
25 | this.responseHeaders.TryGetValue("x-cos-next-append-position", out values);
26 |
27 | if (values != null && values.Count > 0)
28 | {
29 | long tmpPosition;
30 | if (long.TryParse(values[0], out tmpPosition))
31 | {
32 | nextAppendPosition = tmpPosition;
33 | }
34 | }
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/GetObjectTaggingRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Utils;
7 | using COSXML.Model.Tag;
8 |
9 | namespace COSXML.Model.Object
10 | {
11 | ///
12 | /// 获取对象标签
13 | ///
14 | ///
15 | public sealed class GetObjectTaggingRequest : ObjectRequest
16 | {
17 | public GetObjectTaggingRequest(string bucket, string key)
18 | : base(bucket, key)
19 | {
20 | this.method = CosRequestMethod.GET;
21 | this.queryParameters.Add("tagging", null);
22 | }
23 |
24 | ///
25 | /// 指定获取对象某个版本的对象标签
26 | ///
27 | ///
28 | public void SetVersionId(string versionId)
29 | {
30 |
31 | if (versionId != null)
32 | {
33 | SetQueryParameter(CosRequestHeaderKey.VERSION_ID, versionId);
34 | }
35 | }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketRefererRequest.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Common;
2 | using COSXML.Model.Tag;
3 | using COSXML.Network;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Text;
7 |
8 | namespace COSXML.Model.Bucket
9 | {
10 | ///
11 | /// 设置 Bucket 防盗链
12 | ///
13 | ///
14 | public sealed class PutBucketRefererRequest : BucketRequest
15 | {
16 |
17 | public RefererConfiguration refererConfiguration;
18 |
19 | public PutBucketRefererRequest(string bucket) : base(bucket)
20 | {
21 | this.method = CosRequestMethod.PUT;
22 | this.queryParameters.Add("referer", null);
23 | }
24 |
25 | public void SetRefererConfiguration(RefererConfiguration refererConfiguration) {
26 |
27 | this.refererConfiguration = refererConfiguration;
28 | }
29 |
30 | public override Network.RequestBody GetRequestBody()
31 | {
32 | return GetXmlRequestBody(refererConfiguration);
33 | }
34 |
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/DeleteObjectTaggingRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Utils;
7 | using COSXML.Model.Tag;
8 |
9 | namespace COSXML.Model.Object
10 | {
11 | ///
12 | /// 删除对象标签
13 | ///
14 | ///
15 | public sealed class DeleteObjectTaggingRequest : ObjectRequest
16 | {
17 | public DeleteObjectTaggingRequest(string bucket, string key)
18 | : base(bucket, key)
19 | {
20 | this.method = CosRequestMethod.DELETE;
21 | this.queryParameters.Add("tagging", null);
22 | }
23 |
24 | ///
25 | /// 删除对象某个版本的对象标签
26 | ///
27 | ///
28 | public void SetVersionId(string versionId)
29 | {
30 |
31 | if (versionId != null)
32 | {
33 | SetQueryParameter(CosRequestHeaderKey.VERSION_ID, versionId);
34 | }
35 | }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/IntelligentTieringConfiguration.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Serialization;
3 |
4 | namespace COSXML.Model.Tag
5 | {
6 | ///
7 | /// 授予者信息
8 | ///
9 | [XmlRoot]
10 | public sealed class IntelligentTieringConfiguration
11 | {
12 | ///
13 | /// 说明智能分层存储配置是否开启,枚举值:Enabled
14 | ///
15 | [XmlElement]
16 | public string Status;
17 |
18 | [XmlElement]
19 | public IntelligentTieringTransition Transition;
20 |
21 | public sealed class IntelligentTieringTransition
22 | {
23 |
24 | ///
25 | /// 智能分层存储配置中标准层数据转换为低频层数据的天数限制
26 | ///
27 | [XmlElement]
28 | public int Days;
29 |
30 |
31 | ///
32 | /// 指定智能分层存储配置中标准层数据转换为低频层数据的访问次数限制,默认值为0次
33 | ///
34 | public int RequestFrequent;
35 | }
36 |
37 | public Boolean IsEnabled()
38 | {
39 |
40 | return "Enabled".Equals(Status);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Common/CosClientError.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Utils;
7 |
8 | namespace COSXML.Common
9 | {
10 | public enum CosClientError
11 | {
12 | [CosValue("InvalidArgument")]
13 | InvalidArgument = 10000,
14 |
15 | [CosValue("InvalidCredentials")]
16 | InvalidCredentials = 10001,
17 |
18 | [CosValue("BadRequest")]
19 | BadRequest = 10002,
20 |
21 | [CosValue("SinkSourceNotFound")]
22 | SinkSourceNotFound = 10003,
23 |
24 | [CosValue("CRC64ecmaCheckFailed")]
25 | CRC64ecmaCheckFailed = 10004,
26 |
27 | [CosValue("InternalError")]
28 | InternalError = 20000,
29 |
30 | [CosValue("ServerError")]
31 | ServerError = 20001,
32 |
33 | [CosValue("IOError")]
34 | IOError = 20002,
35 |
36 | [CosValue("PoorNetwork")]
37 | PoorNetwork = 20003,
38 |
39 | [CosValue("UserCancelled")]
40 | UserCancelled = 30000,
41 |
42 | [CosValue("AlreadyFinished")]
43 | AlredyFinished = 30001,
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/CosServerError.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Serialization;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Tag
7 | {
8 | ///
9 | /// cos server 返回的错误信息
10 | ///
11 | ///
12 | [XmlRoot("Error")]
13 | public sealed class CosServerError
14 | {
15 | ///
16 | /// 错误码
17 | ///
18 | [XmlElement("Code")]
19 | public string code;
20 |
21 | ///
22 | /// 错误信息
23 | ///
24 | [XmlElement("Message")]
25 | public string message;
26 |
27 | ///
28 | /// 资源地址
29 | ///
30 | [XmlElement("Resource")]
31 | public string resource;
32 |
33 | ///
34 | /// 请求ID
35 | ///
36 | [XmlElement("RequestId")]
37 | public string requestId;
38 |
39 | ///
40 | /// 错误ID
41 | ///
42 | [XmlElement("TraceId")]
43 | public string traceId;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/MediaBuckets.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Xml.Serialization;
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Tag
7 | {
8 | ///
9 | /// 媒体bucket接口返回值
10 | ///
11 | ///
12 | [XmlRoot("Response")]
13 | public sealed class MediaBuckets
14 | {
15 | [XmlElement]
16 | public string RequestId;
17 |
18 | [XmlElement]
19 | public int TotalCount;
20 |
21 | [XmlElement]
22 | public int PageNumber;
23 |
24 | [XmlElement]
25 | public int PageSize;
26 |
27 | [XmlElement]
28 | public List MediaBucketList;
29 |
30 | public sealed class MediaBucketListInfo
31 | {
32 | [XmlElement]
33 | public string BucketId;
34 |
35 | [XmlElement]
36 | public string Name;
37 |
38 | [XmlElement]
39 | public string Region;
40 |
41 | [XmlElement]
42 | public string CreateTime;
43 | }
44 |
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketVersioningRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Model.Tag;
7 | using COSXML.Network;
8 |
9 | namespace COSXML.Model.Bucket
10 | {
11 | public sealed class PutBucketVersioningRequest : BucketRequest
12 | {
13 | private VersioningConfiguration versioningConfiguration;
14 |
15 | public PutBucketVersioningRequest(string bucket)
16 | : base(bucket)
17 | {
18 | this.method = CosRequestMethod.PUT;
19 | this.queryParameters.Add("versioning", null);
20 | versioningConfiguration = new VersioningConfiguration();
21 | }
22 |
23 | public override Network.RequestBody GetRequestBody()
24 | {
25 | return GetXmlRequestBody(versioningConfiguration);
26 | }
27 |
28 |
29 | public void IsEnableVersionConfig(bool isEnable)
30 | {
31 |
32 | if (isEnable)
33 | {
34 | versioningConfiguration.status = "Enabled";
35 | }
36 | else
37 | {
38 | versioningConfiguration.status = "Suspended";
39 | }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/GetObjectResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using System.IO;
6 | using COSXML.CosException;
7 | using COSXML.Common;
8 |
9 | namespace COSXML.Model.Object
10 | {
11 | ///
12 | /// 下载对象返回的结果
13 | ///
14 | ///
15 | public sealed class GetObjectResult : CosResult
16 | {
17 | ///
18 | /// 对象的 eTag
19 | ///
20 | public string eTag;
21 |
22 | ///
23 | /// 对象的 crc64
24 | ///
25 | public string crc64ecma;
26 |
27 | internal override void InternalParseResponseHeaders()
28 | {
29 | List values;
30 |
31 | this.responseHeaders.TryGetValue("ETag", out values);
32 |
33 | if (values != null && values.Count > 0)
34 | {
35 | eTag = values[0];
36 | }
37 |
38 | this.responseHeaders.TryGetValue("x-cos-hash-crc64ecma", out values);
39 |
40 | if (values != null && values.Count > 0)
41 | {
42 | crc64ecma = values[0];
43 | }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/Tagging.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Xml.Serialization;
3 |
4 | namespace COSXML.Model.Tag
5 | {
6 | [XmlRoot("Tagging")]
7 | public sealed class Tagging
8 | {
9 | [XmlElement("TagSet")]
10 | public TagSet tagSet;
11 |
12 | public Tagging()
13 | {
14 | this.tagSet = new TagSet();
15 | }
16 |
17 | public void AddTag(string key, string value)
18 | {
19 | this.tagSet.tags.Add(new Tag(key, value));
20 | }
21 |
22 | public sealed class TagSet
23 | {
24 | [XmlElement("Tag")]
25 | public List tags;
26 |
27 | public TagSet()
28 | {
29 | this.tags = new List();
30 | }
31 | }
32 |
33 | public sealed class Tag
34 | {
35 | [XmlElement("Key")]
36 | public string key;
37 |
38 | [XmlElement("Value")]
39 | public string value;
40 |
41 | public Tag()
42 | {
43 |
44 | }
45 |
46 | public Tag(string key, string value)
47 | {
48 | this.key = key;
49 | this.value = value;
50 | }
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Common/CosVersion.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 | using System.Diagnostics;
5 |
6 | using System.Text;
7 |
8 | namespace COSXML.Common
9 | {
10 | public sealed class CosVersion
11 | {
12 | private static string SDKVersion = "5.4.47.0";
13 | // 主版本号:第一个数字,产品改动较大,可能无法向后兼容(要看具体项目)
14 | // 子版本号:第二个数字,增加了新功能,向后兼容
15 | // 修正版本号:第三个数字,修复BUG 或优化代码,一般没有添加新功能,向后兼容
16 | // 编译版本号:通常是系统自动生成,每次代码提交都会导致自动加1.
17 |
18 | public static string GetUserAgent()
19 | {
20 | StringBuilder userAgent = new StringBuilder();
21 |
22 | userAgent.Append("cos-net-sdk").Append('.')
23 | .Append(SDKVersion);
24 |
25 | return userAgent.ToString();
26 | }
27 |
28 | //public static string GetOsVersion()
29 | //{
30 | // try
31 | // {
32 | // var os = Environment.OSVersion;
33 | // return "windows " + os.Version.Major + "." + os.Version.Minor;
34 | // }
35 | // catch (InvalidOperationException)
36 | // {
37 | // return "Unknown OSVersion";
38 | // }
39 | //}
40 |
41 | //public static string GetOsArchitecture()
42 | //{
43 | // return (IntPtr.Size == 8) ? "x86_64" : "x86";
44 | //}
45 | }
46 | }
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/PutObjectResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using System.IO;
6 | using COSXML.Model.Tag;
7 | using COSXML.Transfer;
8 |
9 | namespace COSXML.Model.Object
10 | {
11 | ///
12 | /// 简单上传对象返回的结果
13 | ///
14 | ///
15 | public sealed class PutObjectResult : CosDataResult
16 | {
17 | ///
18 | /// 对象的eTag
19 | ///
20 | public string eTag;
21 |
22 | ///
23 | /// 对象的 crc64
24 | ///
25 | public string crc64ecma;
26 |
27 | public PicOperationUploadResult uploadResult {
28 | get {return _data; }
29 | }
30 |
31 | internal override void InternalParseResponseHeaders()
32 | {
33 | List values;
34 |
35 | this.responseHeaders.TryGetValue("ETag", out values);
36 |
37 | if (values != null && values.Count > 0)
38 | {
39 | eTag = values[0];
40 | }
41 |
42 | this.responseHeaders.TryGetValue("x-cos-hash-crc64ecma", out values);
43 |
44 | if (values != null && values.Count > 0)
45 | {
46 | crc64ecma = values[0];
47 | }
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXMLTests/Utils/TimeUtilsTests.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using COSXML.Utils;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace COSXML.Utils.Tests
7 | {
8 | [TestFixture()]
9 | public class TimeUtilsTests
10 | {
11 | [Test()]
12 | public void GetCurrentTimeTest()
13 | {
14 | long days = TimeUtils.GetCurrentTime(TimeUnit.Days);
15 | long hours = TimeUtils.GetCurrentTime(TimeUnit.Hours);
16 | long minutes = TimeUtils.GetCurrentTime(TimeUnit.Minutes);
17 | long seconds = TimeUtils.GetCurrentTime(TimeUnit.Seconds);
18 | long milliseconds = TimeUtils.GetCurrentTime(TimeUnit.Milliseconds);
19 |
20 |
21 | }
22 |
23 | [Test()]
24 | public void GetFormatTimeTest()
25 | {
26 | long time = 10;
27 | TimeUtils.GetFormatTime("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", time, TimeUnit.Days);
28 | TimeUtils.GetFormatTime("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", time, TimeUnit.Hours);
29 | TimeUtils.GetFormatTime("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", time, TimeUnit.Minutes);
30 | TimeUtils.GetFormatTime("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", time, TimeUnit.Seconds);
31 | }
32 |
33 |
34 | [Test()]
35 | public void getMermSizeTest()
36 | {
37 | SystemUtils.getMemorySize();
38 | }
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/GrantAccount.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace COSXML.Model.Tag
6 | {
7 | ///
8 | /// 授予者信息
9 | ///
10 | public sealed class GrantAccount
11 | {
12 | internal List idList;
13 |
14 | public GrantAccount()
15 | {
16 | idList = new List();
17 | }
18 |
19 | ///
20 | /// ownerUin,根账号
21 | /// subUin,子账号
22 | ///
23 | ///
24 | ///
25 | public void AddGrantAccount(string ownerUin, string subUin)
26 | {
27 |
28 | if (ownerUin != null && subUin != null)
29 | {
30 | idList.Add(String.Format("id=\"qcs::cam::uin/{0}:uin/{1}\"", ownerUin, subUin));
31 | }
32 | }
33 |
34 | public string GetGrantAccounts()
35 | {
36 | StringBuilder idBuilder = new StringBuilder();
37 |
38 | foreach (string id in idList)
39 | {
40 | idBuilder.Append(id).Append(",");
41 | }
42 |
43 | string idStr = idBuilder.ToString();
44 |
45 | int last = idStr.LastIndexOf(",");
46 |
47 | if (last > 0)
48 | {
49 |
50 | return idStr.Substring(0, last);
51 | }
52 |
53 | return null;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/DescribeMediaBucketsRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Model.Object;
7 | using COSXML.Model.Tag;
8 | using COSXML.CosException;
9 | using COSXML.Utils;
10 |
11 | namespace COSXML.Model.CI
12 | {
13 | ///
14 | /// 提交视频审核任务
15 | ///
16 | ///
17 | public sealed class DescribeMediaBucketsRequest : CIRequest
18 | {
19 | public DescribeMediaBucketsRequest() : base()
20 | {
21 | this.method = CosRequestMethod.GET;
22 | this.SetRequestPath("/mediabucket");
23 | }
24 |
25 | public void SetRegions(string regions)
26 | {
27 | this.queryParameters.Add("regions", regions);
28 | }
29 |
30 | public void SetBucketNames(string bucketNames)
31 | {
32 | this.queryParameters.Add("bucketNames", bucketNames);
33 | }
34 |
35 | public void SetBucketName(string bucketName)
36 | {
37 | this.queryParameters.Add("bucketName", bucketName);
38 | }
39 |
40 | public void SetPageNumber(string pageNumber)
41 | {
42 | this.queryParameters.Add("pageNumber", pageNumber);
43 | }
44 |
45 | public void SetPageSize(string pageSize)
46 | {
47 | this.queryParameters.Add("pageSize", pageSize);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/BucketLoggingStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Serialization;
3 | using System.Text;
4 |
5 | namespace COSXML.Model.Tag
6 | {
7 | [XmlRoot("BucketLoggingStatus")]
8 | public sealed class BucketLoggingStatus
9 | {
10 | [XmlElement("LoggingEnabled")]
11 | public LoggingEnabled loggingEnabled;
12 |
13 | public string GetInfo()
14 | {
15 | StringBuilder stringBuilder = new StringBuilder("{BucketLoggingStatus:\n");
16 |
17 | if (loggingEnabled != null)
18 | {
19 | stringBuilder.Append(loggingEnabled.ToString()).Append("\n");
20 | }
21 |
22 | stringBuilder.Append("}");
23 |
24 | return stringBuilder.ToString();
25 | }
26 |
27 | public sealed class LoggingEnabled
28 | {
29 | [XmlElement("TargetBucket")]
30 | public string targetBucket;
31 |
32 | [XmlElement("TargetPrefix")]
33 | public string targetPrefix;
34 |
35 | public string GetInfo()
36 | {
37 | StringBuilder stringBuilder = new StringBuilder("{LoggingEnabled:\n");
38 |
39 | stringBuilder.Append("TargetBucket:").Append(targetBucket).Append("\n");
40 | stringBuilder.Append("TargetPrefix:").Append(targetPrefix).Append("\n");
41 | stringBuilder.Append("}");
42 |
43 | return stringBuilder.ToString();
44 | }
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Transfer/XmlBuilder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Xml.Serialization;
4 | using System.Text;
5 | using COSXML.Model.Tag;
6 | using System.Xml;
7 | using System.IO;
8 | using COSXML.Utils;
9 |
10 | namespace COSXML.Transfer
11 | {
12 | public sealed class XmlBuilder
13 | {
14 | public static String Serialize(object o)
15 | {
16 | var emptyNs = new XmlSerializerNamespaces(new[] { XmlQualifiedName.Empty });
17 | var settings = new XmlWriterSettings();
18 | settings.Indent = true;
19 | settings.OmitXmlDeclaration = true;
20 |
21 | XmlSerializer serializer = new XmlSerializer(o.GetType());
22 |
23 | using (var stream = new StringWriter())
24 | using (var writer = XmlWriter.Create(stream, settings))
25 | {
26 | serializer.Serialize(writer, o, emptyNs);
27 | return stream.ToString();
28 | }
29 | }
30 |
31 | // private static string RemoveXMLHeader(string xmlContent)
32 | // {
33 |
34 | // if (xmlContent != null)
35 | // {
36 |
37 | // if (xmlContent.StartsWith("");
40 |
41 | // xmlContent = xmlContent.Substring(end + 2);
42 | // }
43 | // }
44 |
45 | // return xmlContent;
46 | // }
47 |
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/CopyObject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Serialization;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Tag
7 | {
8 | ///
9 | /// 复制结果返回信息
10 | ///
11 | ///
12 | [XmlRoot("CopyObjectResult")]
13 | public sealed class CopyObject
14 | {
15 | ///
16 | /// 返回文件的 MD5 算法校验值。ETag 的值可以用于检查 Object 的内容是否发生变化
17 | ///
18 | [XmlElement("ETag")]
19 | public string eTag;
20 |
21 | ///
22 | /// 返回文件最后修改时间,GMT 格式
23 | ///
24 | [XmlElement("LastModified")]
25 | public string lastModified;
26 |
27 | ///
28 | /// key 的 versionId
29 | ///
30 | [XmlElement("VersionId")]
31 | public string versionId;
32 |
33 | ///
34 | /// key 的 versionId
35 | ///
36 | [XmlElement("CRC64")]
37 | public string crc64;
38 |
39 | public string GetInfo()
40 | {
41 | StringBuilder stringBuilder = new StringBuilder("{CopyObject:\n");
42 |
43 | stringBuilder.Append("ETag:").Append(eTag).Append("\n");
44 | stringBuilder.Append("LastModified:").Append(lastModified).Append("\n");
45 | stringBuilder.Append("VersionId:").Append(versionId).Append("\n");
46 | stringBuilder.Append("}");
47 |
48 | return stringBuilder.ToString();
49 | }
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/.github/workflows/auto-changelog.yml:
--------------------------------------------------------------------------------
1 | name: ChangeLog
2 |
3 | on:
4 | workflow_dispatch:
5 | release:
6 | types: [published]
7 |
8 | jobs:
9 | build:
10 |
11 | runs-on: ubuntu-latest
12 |
13 | steps:
14 | - uses: actions/setup-node@v2-beta
15 | with:
16 | node-version: '12'
17 | - uses: actions/checkout@v2
18 | with:
19 | fetch-depth: 0
20 |
21 | - name: Checkout Tool
22 | uses: actions/checkout@v2
23 | with:
24 | repository: konakonall/auto-changelog
25 | path: 'auto-changelog'
26 | - name: Build Tool
27 | run: |
28 | cd auto-changelog
29 | npm install
30 | npm link
31 |
32 | - name: Generate ChangeLog
33 | env: # Or as an environment variable
34 | TOKEN: ${{ secrets.GITHUB_TOKEN }}
35 | run: |
36 | auto-changelog --token $TOKEN
37 | - name: Cat ChangeLog
38 | run: cat CHANGELOG.md
39 |
40 | - name: Commit files
41 | env:
42 | CI_USER: "gouki0123"
43 | CI_EMAIL: "gouki0123@gmail.com"
44 | run: |
45 | git config --local user.email "$CI_EMAIL"
46 | git config --local user.name "$CI_USER"
47 | git add CHANGELOG.md && git commit -m 'Updated CHANGELOG.md' && echo "push=1" >> $GITHUB_ENV || echo "No changes to CHANGELOG.md"
48 |
49 | - name: Push changes
50 | if: env.push == 1
51 | env:
52 | CI_USER: "gouki0123"
53 | CI_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54 | run: |
55 | git push "https://$CI_USER:$CI_TOKEN@github.com/$GITHUB_REPOSITORY.git" HEAD:master
56 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/QRRecognitionResult.cs:
--------------------------------------------------------------------------------
1 | using System.Xml.Serialization;
2 | using System.Collections.Generic;
3 |
4 | namespace COSXML.Model.Tag
5 | {
6 | ///
7 | /// 图片审核结果
8 | ///
9 | [XmlRoot("Response")]
10 | public sealed class QRRecognitionResult
11 | {
12 |
13 | ///
14 | /// 二维码识别结果
15 | ///
16 | [XmlElement]
17 | public int CodeStatus;
18 |
19 | ///
20 | /// 二维码识别结果
21 | ///
22 | [XmlElement]
23 | public QRcodeRecognitionInfo QRcodeInfo;
24 |
25 | ///
26 | /// 处理后的图片 base64数据,请求参数 cover 为1时返回
27 | ///
28 | [XmlElement]
29 | public string ResultImage;
30 |
31 | ///
32 | /// 二维码识别结果
33 | ///
34 | public sealed class QRcodeRecognitionInfo
35 | {
36 | ///
37 | /// 二维码的内容
38 | ///
39 | [XmlElement]
40 | public string CodeUrl;
41 |
42 | ///
43 | /// 图中识别到的二维码位置坐标
44 | ///
45 | [XmlElement]
46 | public CodeLocationInfo CodeLocation;
47 | }
48 |
49 | ///
50 | /// 二维码位置坐标
51 | ///
52 | public sealed class CodeLocationInfo
53 | {
54 | ///
55 | /// 二维码的内容
56 | ///
57 | [XmlElement]
58 | public List Point;
59 | }
60 | }
61 | }
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/PutObjectTaggingRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Utils;
7 | using COSXML.Model.Tag;
8 |
9 | namespace COSXML.Model.Object
10 | {
11 | ///
12 | /// 设置对象标签
13 | ///
14 | ///
15 | public sealed class PutObjectTaggingRequest : ObjectRequest
16 | {
17 | private Tagging tagging;
18 |
19 | public PutObjectTaggingRequest(string bucket, string key)
20 | : base(bucket, key)
21 | {
22 | this.method = CosRequestMethod.PUT;
23 | this.queryParameters.Add("tagging", null);
24 | this.tagging = new Tagging();
25 | }
26 |
27 | ///
28 | /// 向指定版本的对象添加标签
29 | ///
30 | ///
31 | public void SetVersionId(string versionId)
32 | {
33 |
34 | if (versionId != null)
35 | {
36 | SetQueryParameter(CosRequestHeaderKey.VERSION_ID, versionId);
37 | }
38 | }
39 |
40 | ///
41 | /// 向标签键值对增加内容
42 | ///
43 | ///
44 | ///
45 | public void AddTag(string key, string value)
46 | {
47 | this.tagging.AddTag(key, value);
48 | }
49 |
50 | public override Network.RequestBody GetRequestBody()
51 | {
52 | return GetXmlRequestBody(tagging);
53 | }
54 |
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/CompleteResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Xml.Serialization;
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Tag
7 | {
8 | ///
9 | /// 分片上传完成结果
10 | ///
11 | ///
12 | [XmlRoot("CompleteMultipartUploadResult")]
13 | public sealed class CompleteResult
14 | {
15 | ///
16 | /// 创建的Object的外网访问域名
17 | ///
18 | [XmlElement("Location")]
19 | public string location;
20 |
21 | ///
22 | /// 分块上传的目标Bucket
23 | ///
24 | [XmlElement("Bucket")]
25 | public string bucket;
26 |
27 | ///
28 | /// Object的名称
29 | ///
30 | [XmlElement("Key")]
31 | public string key;
32 |
33 | ///
34 | /// 合并后对象的唯一标签值,该值不是对象内容的 MD5 校验值,仅能用于检查对象唯一性
35 | ///
36 | [XmlElement("ETag")]
37 | public string eTag;
38 |
39 |
40 | public string GetInfo()
41 | {
42 | StringBuilder stringBuilder = new StringBuilder("{CompleteMultipartUploadResult:\n");
43 |
44 | stringBuilder.Append("Location:").Append(location).Append("\n");
45 | stringBuilder.Append("Bucket:").Append(bucket).Append("\n");
46 | stringBuilder.Append("Key:").Append(key).Append("\n");
47 | stringBuilder.Append("ETag:").Append(eTag).Append("\n");
48 | stringBuilder.Append("}");
49 |
50 | return stringBuilder.ToString();
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/RestoreConfigure.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Serialization;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Utils;
7 |
8 | namespace COSXML.Model.Tag
9 | {
10 | [XmlRoot("RestoreRequest")]
11 | public sealed class RestoreConfigure
12 | {
13 | ///
14 | /// 设置临时副本的过期时间
15 | ///
16 | [XmlElement("Days")]
17 | public int days;
18 |
19 | ///
20 | /// 归档存储工作参数配置
21 | ///
22 | ///
23 | [XmlElement("CASJobParameters")]
24 | public CASJobParameters casJobParameters;
25 |
26 | public sealed class CASJobParameters
27 | {
28 | ///
29 | /// 恢复数据时,Tier 可以指定为 CAS 支持的三种恢复类型,分别为 Expedited、Standard、Bulk
30 | ///
31 | ///
32 | [XmlElement("Tier")]
33 | public Tier tier = Tier.Standard;
34 | }
35 |
36 | public enum Tier
37 | {
38 | [CosValue("Expedited")]
39 | Expedited = 0,
40 |
41 | [CosValue("Standard")]
42 | Standard,
43 |
44 | [CosValue("Bulk")]
45 | Bulk
46 | }
47 | }
48 |
49 | [XmlRoot("RestoreRequest")]
50 | public sealed class RestoreConfigureNoDays
51 | {
52 | ///
53 | /// 归档存储工作参数配置
54 | ///
55 | ///
56 | [XmlElement("CASJobParameters")]
57 | public RestoreConfigure.CASJobParameters casJobParameters;
58 | }
59 |
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketLoggingRequest.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Common;
2 | using COSXML.Model.Tag;
3 | using COSXML.Network;
4 | using COSXML.CosException;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Text;
8 |
9 | namespace COSXML.Model.Bucket
10 | {
11 | public sealed class PutBucketLoggingRequest : BucketRequest
12 | {
13 | private BucketLoggingStatus bucketLoggingStatus;
14 |
15 | public PutBucketLoggingRequest(string bucket) : base(bucket)
16 | {
17 | this.method = CosRequestMethod.PUT;
18 | this.queryParameters.Add("logging", null);
19 | this.bucketLoggingStatus = new BucketLoggingStatus();
20 | }
21 |
22 | public void SetTarget(string targetBucket, string targetPrefix = "")
23 | {
24 |
25 | if (targetBucket == null || targetBucket == "")
26 | {
27 | throw new CosClientException((int)CosClientError.InvalidArgument,
28 | "targetBucket is null or empty");
29 | }
30 |
31 | // 可选参数,传 null 填入空白
32 | if (targetPrefix == null)
33 | {
34 | targetPrefix = "";
35 | }
36 |
37 | if (bucketLoggingStatus.loggingEnabled == null)
38 | {
39 | bucketLoggingStatus.loggingEnabled = new BucketLoggingStatus.LoggingEnabled();
40 | }
41 |
42 | bucketLoggingStatus.loggingEnabled.targetBucket = targetBucket;
43 |
44 | bucketLoggingStatus.loggingEnabled.targetPrefix = targetPrefix;
45 | }
46 |
47 | public override Network.RequestBody GetRequestBody()
48 | {
49 | return GetXmlRequestBody(bucketLoggingStatus);
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/AbortMultipartUploadRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.CosException;
7 |
8 | namespace COSXML.Model.Object
9 | {
10 | ///
11 | /// 舍弃一个分块上传并删除已上传的块
12 | ///
13 | ///
14 | public sealed class AbortMultipartUploadRequest : ObjectRequest
15 | {
16 | ///
17 | /// 分片块的UploadId,使用 Initiate Multipart Upload 接口初始化分片上传时会得到一个 uploadId,该 ID 不但唯一标识这一分块数据,也标识了这分块数据在整个文件内的相对位置
18 | ///
19 | private string uploadId;
20 |
21 | public AbortMultipartUploadRequest(string bucket, string key, string uploadId)
22 | : base(bucket, key)
23 | {
24 | this.uploadId = uploadId;
25 | this.method = CosRequestMethod.DELETE;
26 | }
27 |
28 | public override void CheckParameters()
29 | {
30 |
31 | if (requestUrlWithSign != null)
32 | {
33 |
34 | return;
35 | }
36 |
37 | base.CheckParameters();
38 |
39 | if (uploadId == null)
40 | {
41 | throw new CosClientException((int)CosClientError.InvalidArgument, "uploadId is null");
42 | }
43 | }
44 |
45 | protected override void InternalUpdateQueryParameters()
46 | {
47 |
48 | try
49 | {
50 | this.queryParameters.Add("uploadId", uploadId);
51 | }
52 | catch (ArgumentException)
53 | {
54 | this.queryParameters["uploadId"] = uploadId;
55 | }
56 |
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/PreSignatureStruct.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace COSXML.Model.Tag
6 | {
7 | public sealed class PreSignatureStruct
8 | {
9 | ///
10 | /// cos 服务的appid
11 | ///
12 | public string appid;
13 |
14 | ///
15 | /// 存储桶名称
16 | ///
17 | public string bucket;
18 |
19 | ///
20 | /// Bucket所属地域
21 | ///
22 | public string region;
23 |
24 | ///
25 | /// 设置 host
26 | ///
27 | public string host;
28 |
29 | ///
30 | /// 对象键
31 | ///
32 | public string key;
33 |
34 | ///
35 | /// true:https; false: http
36 | ///
37 | public bool isHttps;
38 |
39 | ///
40 | /// 签名中是否签入host
41 | ///
42 | public bool signHost = false;
43 |
44 | ///
45 | /// http request method : get , put , etc.
46 | ///
47 | public string httpMethod;
48 |
49 | ///
50 | /// 签名需要校验的url中查询参数
51 | ///
52 | public Dictionary queryParameters;
53 |
54 | ///
55 | /// 签名需要校验的headers
56 | ///
57 | public Dictionary headers;
58 |
59 | ///
60 | /// 签名 sign的有效期,若 小于 0,则取keyTime.
61 | ///
62 | public long signDurationSecond;
63 |
64 | ///
65 | /// 签名 key的有效期,不设置 或 小于 0, 则取 QCloudCredential中的keyTime
66 | ///
67 | public long keyDurationSecond;
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Listener/CosCallback.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using COSXML.Model;
5 | using COSXML.CosException;
6 | using System.IO;
7 |
8 | namespace COSXML.Callback
9 | {
10 | ///
11 | /// 上传、下载进度回调
12 | ///
13 | ///
14 | ///
15 | public delegate void OnProgressCallback(long completed, long total);
16 |
17 | ///
18 | /// 获取结果的回调
19 | ///
20 | public delegate void OnNotifyGetResponse();
21 |
22 | ///
23 | /// 请求成功回调
24 | ///
25 | ///
26 | ///
27 | ///
28 | ///
29 | public delegate void OnSuccessCallback(T cosResult)
30 | where T : CosResult;
31 |
32 | ///
33 | /// 请求失败回调
34 | ///
35 | ///
36 | ///
37 | ///
38 | ///
39 | public delegate void OnFailedCallback(CosClientException clientException, CosServerException serverException);
40 |
41 | ///
42 | /// 解析流回调
43 | ///
44 | ///
45 | ///
46 | ///
47 | /// throw CosServerException
48 | /// throw CosClientException
49 | /// throw Excetpion
50 | public delegate void OnParseStream(Stream inputStream, string contentType, long contentLength);
51 | }
52 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/SensitiveContentRecognitionRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Model.Object;
7 | using COSXML.Model.Tag;
8 | using COSXML.CosException;
9 | using COSXML.Utils;
10 |
11 | namespace COSXML.Model.CI
12 | {
13 | ///
14 | /// 图片审核
15 | ///
16 | ///
17 | public sealed class SensitiveContentRecognitionRequest : ObjectRequest
18 | {
19 | public SensitiveContentRecognitionRequest(string bucket, string key)
20 | : base(bucket,key){
21 |
22 | this.method = CosRequestMethod.GET;
23 | this.queryParameters.Add("ci-process", "sensitive-content-recognition");
24 | }
25 | public void SetBizType(string bizType){
26 | this.queryParameters.Add("biz-type", bizType);
27 | }
28 |
29 | public void SetDetectUrl(string detectUrl){
30 | this.queryParameters.Add("detect-url", detectUrl);
31 | }
32 |
33 | public void SetInterval(string interval){
34 | this.queryParameters.Add("interval", interval);
35 | }
36 |
37 | public void SetMaxFrames(string maxFrames){
38 | this.queryParameters.Add("max-frames", maxFrames);
39 | }
40 |
41 | public void SetLargeImageDetect(string largeImageDetect){
42 | this.queryParameters.Add("large-image-detect", largeImageDetect);
43 | }
44 |
45 | public void SetDataid(string dataid){
46 | this.queryParameters.Add("dataid", dataid);
47 | }
48 |
49 | public void SetAsync(string async){
50 | this.queryParameters.Add("async", async);
51 | }
52 |
53 | public void SetCallback(string callback){
54 | this.queryParameters.Add("callback", callback);
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/ListInventoryConfiguration.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Xml.Serialization;
5 |
6 | namespace COSXML.Model.Tag
7 | {
8 | [XmlRoot("ListInventoryConfigurationResult")]
9 | public sealed class ListInventoryConfiguration
10 | {
11 | [XmlElement("InventoryConfiguration")]
12 | public List inventoryConfigurations;
13 |
14 | [XmlElement("IsTruncated")]
15 | public bool isTruncated = false;
16 |
17 | [XmlElement("ContinuationToken")]
18 | public string continuationToken;
19 |
20 | [XmlElement("NextContinuationToken")]
21 | public string nextContinuationToken;
22 |
23 | public String GetInfo()
24 | {
25 | StringBuilder stringBuilder = new StringBuilder("{ListInventoryConfigurationResult\n");
26 |
27 | stringBuilder.Append("IsTruncated:").Append(isTruncated).Append("\n");
28 |
29 | if (continuationToken != null)
30 | {
31 | stringBuilder.Append("ContinuationToken:").Append(continuationToken).Append("\n");
32 | }
33 |
34 | if (nextContinuationToken != null)
35 | {
36 | stringBuilder.Append("NextContinuationToken:").Append(nextContinuationToken).Append("\n");
37 | }
38 |
39 | if (inventoryConfigurations != null)
40 | {
41 |
42 | foreach (InventoryConfiguration inventoryConfiguration in inventoryConfigurations)
43 | {
44 |
45 | if (inventoryConfiguration != null)
46 | {
47 | stringBuilder.Append(inventoryConfiguration.GetInfo()).Append("\n");
48 | }
49 | }
50 | }
51 |
52 | stringBuilder.Append("}");
53 |
54 | return stringBuilder.ToString();
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/ObjectSelectionFormat.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Xml.Serialization;
3 |
4 | namespace COSXML.Model.Tag
5 | {
6 | public sealed class ObjectSelectionFormat
7 | {
8 |
9 | [XmlElement("CompressionType")]
10 | public string compressionType;
11 |
12 | [XmlElement("CSV")]
13 | public CSVFormat csvFormat;
14 |
15 | [XmlElement("JSON")]
16 | public JSONFormat jsonFormat;
17 |
18 | public ObjectSelectionFormat()
19 | {
20 | }
21 |
22 | public ObjectSelectionFormat(string compressionType, CSVFormat csv)
23 | {
24 | this.compressionType = compressionType;
25 | this.csvFormat = csv;
26 | this.jsonFormat = null;
27 | }
28 |
29 | public ObjectSelectionFormat(string compressionType, JSONFormat json)
30 | {
31 | this.compressionType = compressionType;
32 | this.csvFormat = null;
33 | this.jsonFormat = json;
34 | }
35 |
36 | public sealed class CSVFormat
37 | {
38 | [XmlElement]
39 | public string FileHeaderInfo;
40 |
41 | [XmlElement]
42 | public string RecordDelimiter;
43 |
44 | [XmlElement]
45 | public string FieldDelimiter;
46 |
47 | [XmlElement]
48 | public string QuoteCharacter;
49 |
50 | [XmlElement]
51 | public string QuoteEscapeCharacter;
52 |
53 | [XmlElement]
54 | public string Comments;
55 |
56 | [XmlElement]
57 | public bool AllowQuotedRecordDelimiter;
58 |
59 | [XmlElement]
60 | public string QuoteFields;
61 | }
62 |
63 | public sealed class JSONFormat
64 | {
65 | [XmlElement]
66 | public string Type;
67 |
68 | [XmlElement]
69 | public string RecordDelimiter;
70 | }
71 | }
72 | }
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/COSXML-Netcore.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {FC694C68-F0E3-411F-8E6C-2E9F94826016}
5 | Library
6 | Properties
7 | COSXML
8 | COSXML
9 | netstandard2.0;net45
10 | 512
11 | true
12 |
13 | Tencent.QCloud.Cos.Sdk
14 | 5.4.47.0
15 | Tencent
16 | Tencent
17 | Tencent Cloud COS(Cloud Object Service) .Net SDK
18 |
19 |
20 |
21 |
22 | true
23 | full
24 | false
25 | bin\Debug\
26 | DEBUG;TRACE
27 | prompt
28 | 4
29 | false
30 |
31 |
32 |
33 | pdbonly
34 | true
35 | bin\Release\
36 | TRACE
37 | prompt
38 | 4
39 | bin\Release\COSXML.xml
40 | false
41 |
42 |
43 |
44 | true
45 | bin\COSXML.XML
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/GetObjectBytesResult.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Collections.Generic;
4 | using System.IO;
5 |
6 | namespace COSXML.Model.Object
7 | {
8 | public sealed class GetObjectBytesResult : CosResult
9 | {
10 | public string eTag;
11 |
12 | public byte[] content;
13 |
14 | private COSXML.Callback.OnProgressCallback progressCallback;
15 |
16 |
17 | internal override void ExternInfo(CosRequest cosRequest)
18 | {
19 | base.ExternInfo(cosRequest);
20 | GetObjectBytesRequest getObjectBytesRequest = cosRequest as GetObjectBytesRequest;
21 |
22 | this.progressCallback = getObjectBytesRequest.GetCosProgressCallback();
23 | }
24 |
25 | internal override void InternalParseResponseHeaders()
26 | {
27 | List values;
28 |
29 | this.responseHeaders.TryGetValue("ETag", out values);
30 |
31 | if (values != null && values.Count > 0)
32 | {
33 | eTag = values[0];
34 | }
35 | }
36 |
37 |
38 | internal override void ParseResponseBody(Stream inputStream, string contentType, long contentLength)
39 | {
40 | content = new byte[contentLength];
41 | int completed = 0;
42 |
43 | while (completed < contentLength)
44 | {
45 | int recvLen = inputStream.Read(content, completed, (int)Math.Min(2048, contentLength - completed));
46 |
47 | completed += recvLen;
48 |
49 | if (progressCallback != null)
50 | {
51 | progressCallback(completed, content.Length);
52 | }
53 | }
54 | // Unity 上不支持
55 | // using(var memoryStream = new MemoryStream())
56 | // {
57 | // inputStream.CopyTo(memoryStream);
58 | // content = memoryStream.ToArray();
59 | // }
60 |
61 | }
62 |
63 | }
64 |
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/SubmitDocumentCensorJobRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Model.Object;
7 | using COSXML.Model.Tag;
8 | using COSXML.CosException;
9 | using COSXML.Utils;
10 |
11 | namespace COSXML.Model.CI
12 | {
13 | ///
14 | /// 提交文档审核任务
15 | ///
16 | ///
17 | public sealed class SubmitDocumentCensorJobRequest : CIRequest
18 | {
19 | public DocumentCensorJobInfo documentCensorJobInfo;
20 | public SubmitDocumentCensorJobRequest(string bucket)
21 | : base(bucket)
22 | {
23 | documentCensorJobInfo = new DocumentCensorJobInfo();
24 | this.method = CosRequestMethod.POST;
25 | this.SetRequestPath("/document/auditing");
26 | this.SetRequestHeader("Content-Type", "application/xml");
27 | documentCensorJobInfo.input = new DocumentCensorJobInfo.Input();
28 | documentCensorJobInfo.conf = new DocumentCensorJobInfo.Conf();
29 | }
30 |
31 | public void SetUrl(string Url)
32 | {
33 | documentCensorJobInfo.input.url = Url;
34 | }
35 |
36 | public void SetType(string type)
37 | {
38 | documentCensorJobInfo.input.type = type;
39 | }
40 |
41 | public void SetDetectType(string detectType)
42 | {
43 | documentCensorJobInfo.conf.detectType = detectType;
44 | }
45 |
46 | public void SetCallback(string callbackUrl)
47 | {
48 | documentCensorJobInfo.conf.callback = callbackUrl;
49 | }
50 |
51 | public void SetBizType(string BizType)
52 | {
53 | documentCensorJobInfo.conf.bizType = BizType;
54 | }
55 |
56 | public override Network.RequestBody GetRequestBody()
57 | {
58 | return GetXmlRequestBody(documentCensorJobInfo);
59 | }
60 |
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Utils/SystemUtils.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 |
5 | namespace COSXML.Utils
6 | {
7 | public class SystemUtils
8 | {
9 | ///
10 | /// 获取当前占用系统内存大小
11 | ///
12 | public static void getMemorySize()
13 | {
14 | Process currentProcess = Process.GetCurrentProcess();
15 | // 获取当前进程占用的内存大小(以字节为单位)
16 | long memorySize = currentProcess.WorkingSet64;
17 | // 将字节转换为兆字节(MB)
18 | double memorySizeInMB = (double)memorySize / (1024 * 1024);
19 | Console.WriteLine("内存大小是:" + memorySizeInMB + "MB");
20 | }
21 |
22 |
23 | public static bool DeleteFileByFileName(string fileName)
24 | {
25 | if (File.Exists(fileName)) {
26 | System.IO.File.Delete(fileName);
27 | return true;
28 | }
29 | return false;
30 | }
31 |
32 |
33 | public static string CreateFileByParam(string path, string filename, long size)
34 | {
35 | if (!Directory.Exists(path)) {
36 | // 创建目录
37 | Directory.CreateDirectory(path);
38 | }
39 |
40 | // 检查文件是否存在
41 | string filePath = Path.Combine(path, filename);
42 | if (!File.Exists(filePath))
43 | {
44 | FileStream fs = new FileStream(filePath, FileMode.Create);
45 | fs.SetLength(size);
46 | path = fs.Name;
47 | fs.Close();
48 | }
49 | return filePath;
50 | }
51 |
52 | public static void GetThrand()
53 | {
54 | // 获取当前进程
55 | Process currentProcess = Process.GetCurrentProcess();
56 | // 获取当前进程的线程数量
57 | int threadCount = currentProcess.Threads.Count;
58 | // 输出线程数量
59 | Console.WriteLine("当前进程的线程数量: " + threadCount);
60 | }
61 |
62 | }
63 | }
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/ListBucketVersionsRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Bucket
8 | {
9 | public sealed class ListBucketVersionsRequest : BucketRequest
10 | {
11 | public ListBucketVersionsRequest(string bucket)
12 | : base(bucket)
13 | {
14 | this.method = CosRequestMethod.GET;
15 | this.queryParameters.Add("versions", null);
16 | }
17 |
18 | public void SetPrefix(string prefix)
19 | {
20 |
21 | if (prefix != null)
22 | {
23 | SetQueryParameter("prefix", prefix);
24 | }
25 | }
26 |
27 | public void SetKeyMarker(string keyMarker)
28 | {
29 |
30 | if (keyMarker != null)
31 | {
32 | SetQueryParameter("key-marker", keyMarker);
33 | }
34 | }
35 |
36 | public void SetVersionIdMarker(string versionIdMarker)
37 | {
38 |
39 | if (versionIdMarker != null)
40 | {
41 | SetQueryParameter("version-id-marker", versionIdMarker);
42 | }
43 | }
44 |
45 | public void SetDelimiter(string delimiter)
46 | {
47 |
48 | if (delimiter != null)
49 | {
50 | SetQueryParameter("delimiter", delimiter);
51 | }
52 | }
53 |
54 | public void SetEncodingType(string encodingType)
55 | {
56 |
57 | if (encodingType != null)
58 | {
59 | SetQueryParameter("encoding-type", encodingType);
60 | }
61 | }
62 |
63 | public void SetMaxKeys(string maxKeys)
64 | {
65 |
66 | if (maxKeys != null)
67 | {
68 | SetQueryParameter("max-keys", maxKeys);
69 | }
70 | else
71 | {
72 | SetQueryParameter("max-keys", "1000");
73 | }
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/QCloudCSharpSDK.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.0.31903.59
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "COSXML-Netcore", "COSXML\COSXML-Netcore.csproj", "{FC694C68-F0E3-411F-8E6C-2E9F94826016}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "COSXMLTests", "COSXMLTests\COSXMLTests.csproj", "{9DC6553F-DF2A-4EC8-9790-2068ADF94CB8}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "COSXMLDemo", "COSXMLDemo\COSXMLDemo.csproj", "{06505112-4F1D-4AE5-9E8A-07D5D98B2AB3}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {FC694C68-F0E3-411F-8E6C-2E9F94826016}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22 | {FC694C68-F0E3-411F-8E6C-2E9F94826016}.Debug|Any CPU.Build.0 = Debug|Any CPU
23 | {FC694C68-F0E3-411F-8E6C-2E9F94826016}.Release|Any CPU.ActiveCfg = Release|Any CPU
24 | {FC694C68-F0E3-411F-8E6C-2E9F94826016}.Release|Any CPU.Build.0 = Release|Any CPU
25 | {9DC6553F-DF2A-4EC8-9790-2068ADF94CB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26 | {9DC6553F-DF2A-4EC8-9790-2068ADF94CB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
27 | {9DC6553F-DF2A-4EC8-9790-2068ADF94CB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
28 | {9DC6553F-DF2A-4EC8-9790-2068ADF94CB8}.Release|Any CPU.Build.0 = Release|Any CPU
29 | {06505112-4F1D-4AE5-9E8A-07D5D98B2AB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30 | {06505112-4F1D-4AE5-9E8A-07D5D98B2AB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
31 | {06505112-4F1D-4AE5-9E8A-07D5D98B2AB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
32 | {06505112-4F1D-4AE5-9E8A-07D5D98B2AB3}.Release|Any CPU.Build.0 = Release|Any CPU
33 | EndGlobalSection
34 | EndGlobal
35 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketIntelligentTieringRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using System.Text;
4 | using COSXML.Common;
5 | using COSXML.Model.Tag;
6 | using COSXML.Network;
7 | using COSXML.CosException;
8 |
9 | namespace COSXML.Model.Bucket
10 | {
11 | ///
12 | /// 设置 Bucket 生命周期
13 | ///
14 | ///
15 | public sealed class PutBucketIntelligentTieringRequest : BucketRequest
16 | {
17 | private IntelligentTieringConfiguration configuration;
18 |
19 | public PutBucketIntelligentTieringRequest(string bucket, IntelligentTieringConfiguration configuration)
20 | : base(bucket)
21 | {
22 |
23 | if (String.IsNullOrEmpty(configuration.Status))
24 | {
25 | configuration.Status = "Enabled";
26 | }
27 |
28 | if (configuration.Transition == null)
29 | {
30 | configuration.Transition = new IntelligentTieringConfiguration.IntelligentTieringTransition();
31 | }
32 |
33 | if (configuration.Transition.Days < 1)
34 | {
35 | configuration.Transition.Days = 30;
36 | }
37 |
38 | if (configuration.Transition.RequestFrequent < 1)
39 | {
40 | configuration.Transition.RequestFrequent = 1;
41 | }
42 |
43 | this.method = CosRequestMethod.PUT;
44 | this.queryParameters.Add("intelligenttiering", null);
45 | this.configuration = configuration;
46 | }
47 |
48 | public override Network.RequestBody GetRequestBody()
49 | {
50 | return GetXmlRequestBody(configuration);
51 | }
52 |
53 | public override void CheckParameters()
54 | {
55 | base.CheckParameters();
56 |
57 | if (String.IsNullOrEmpty(configuration.Status))
58 | {
59 | throw new CosClientException((int)CosClientError.InvalidArgument, "Status 不能为空");
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/SubmitTextCensorJobRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Model.Object;
7 | using COSXML.Model.Tag;
8 | using COSXML.CosException;
9 | using COSXML.Utils;
10 |
11 | namespace COSXML.Model.CI
12 | {
13 | ///
14 | /// 提交文本审核任务
15 | ///
16 | ///
17 | public sealed class SubmitTextCensorJobRequest : CIRequest
18 | {
19 | public TextCensorJobInfo textCensorJobInfo;
20 | public SubmitTextCensorJobRequest(string bucket)
21 | : base(bucket)
22 | {
23 | textCensorJobInfo = new TextCensorJobInfo();
24 | this.method = CosRequestMethod.POST;
25 | this.SetRequestPath("/text/auditing");
26 | this.SetRequestHeader("Content-Type", "application/xml");
27 | textCensorJobInfo.input = new TextCensorJobInfo.Input();
28 | textCensorJobInfo.conf = new TextCensorJobInfo.Conf();
29 | }
30 |
31 | public void SetCensorObject(string key)
32 | {
33 | textCensorJobInfo.input.obj = key;
34 | }
35 |
36 | public void SetCensorUrl(string url)
37 | {
38 | textCensorJobInfo.input.url = url;
39 | }
40 |
41 | public void SetCensorContent(string content)
42 | {
43 | textCensorJobInfo.input.content = content;
44 | }
45 |
46 | public void SetDetectType(string detectType)
47 | {
48 | textCensorJobInfo.conf.detectType = detectType;
49 | }
50 |
51 | public void SetCallback(string callbackUrl)
52 | {
53 | textCensorJobInfo.conf.callback = callbackUrl;
54 | }
55 |
56 | public void SetBizType(string BizType)
57 | {
58 | textCensorJobInfo.conf.bizType = BizType;
59 | }
60 |
61 | public override Network.RequestBody GetRequestBody()
62 | {
63 | return GetXmlRequestBody(textCensorJobInfo);
64 | }
65 |
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/WebsiteConfiguration.cs:
--------------------------------------------------------------------------------
1 | using System.Xml.Serialization;
2 | using System.Collections.Generic;
3 | using System;
4 |
5 | namespace COSXML.Model.Tag
6 | {
7 | [XmlRoot]
8 | public sealed class WebsiteConfiguration
9 | {
10 | [XmlElement("IndexDocument")]
11 | public IndexDocument indexDocument;
12 |
13 | [XmlElement("ErrorDocument")]
14 | public ErrorDocument errorDocument;
15 |
16 | [XmlElement("RedirectAllRequestsTo")]
17 | public RedirectAllRequestTo redirectAllRequestTo;
18 |
19 | [XmlArray("RoutingRules")]
20 | public List routingRules;
21 |
22 | public sealed class IndexDocument
23 | {
24 | [XmlElement("Suffix")]
25 | public string suffix;
26 | }
27 |
28 | public sealed class ErrorDocument
29 | {
30 | [XmlElement("Key")]
31 | public string key;
32 | }
33 |
34 | public sealed class RedirectAllRequestTo
35 | {
36 | [XmlElement("Protocol")]
37 | public string protocol;
38 | }
39 |
40 | public sealed class RoutingRule
41 | {
42 | [XmlElement("Condition")]
43 | public Contidion contidion;
44 |
45 | [XmlElement("Redirect")]
46 | public Redirect redirect;
47 | }
48 |
49 | public sealed class Contidion
50 | {
51 | [XmlIgnore]
52 | public int httpErrorCodeReturnedEquals;
53 |
54 | [XmlElement("HttpErrorCodeReturnedEquals")]
55 | public string httpErrorCodeReturnedEqualsStr;
56 |
57 | [XmlElement("KeyPrefixEquals")]
58 | public string keyPrefixEquals;
59 | }
60 |
61 | public sealed class Redirect
62 | {
63 | [XmlElement("Protocol")]
64 | public string protocol;
65 |
66 | [XmlElement("ReplaceKeyWith")]
67 | public string replaceKeyWith;
68 |
69 | [XmlElement("ReplaceKeyPrefixWith")]
70 | public string replaceKeyPrefixWith;
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/SubmitAudioCensorJobRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Model.Object;
7 | using COSXML.Model.Tag;
8 | using COSXML.CosException;
9 | using COSXML.Utils;
10 |
11 | namespace COSXML.Model.CI
12 | {
13 | ///
14 | /// 提交音频审核任务
15 | ///
16 | ///
17 | public sealed class SubmitAudioCensorJobRequest : CIRequest
18 | {
19 | public AudioCencorJobInfo audioCencorJobInfo;
20 | public SubmitAudioCensorJobRequest(string bucket)
21 | : base(bucket)
22 | {
23 | audioCencorJobInfo = new AudioCencorJobInfo();
24 | this.method = CosRequestMethod.POST;
25 | this.SetRequestPath("/audio/auditing");
26 | this.SetRequestHeader("Content-Type", "application/xml");
27 | audioCencorJobInfo.input = new AudioCencorJobInfo.Input();
28 | audioCencorJobInfo.conf = new AudioCencorJobInfo.Conf();
29 | }
30 |
31 | public void SetCensorObject(string key)
32 | {
33 | audioCencorJobInfo.input.obj = key;
34 | }
35 |
36 | public void SetCensorUrl(string url)
37 | {
38 | audioCencorJobInfo.input.url = url;
39 | }
40 |
41 | public void SetDetectType(string detectType)
42 | {
43 | audioCencorJobInfo.conf.detectType = detectType;
44 | }
45 |
46 | public void SetCallback(string callbackUrl)
47 | {
48 | audioCencorJobInfo.conf.callback = callbackUrl;
49 | }
50 |
51 | public void SetCallbackVersion(string callbackVersion)
52 | {
53 | audioCencorJobInfo.conf.callbackVersion = callbackVersion;
54 | }
55 |
56 | public void SetBizType(string BizType)
57 | {
58 | audioCencorJobInfo.conf.bizType = BizType;
59 | }
60 |
61 | public override Network.RequestBody GetRequestBody()
62 | {
63 | return GetXmlRequestBody(audioCencorJobInfo);
64 | }
65 |
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # qcloud-sdk-dotnet
2 |
3 |  
4 |
5 | 腾讯云 COS XML .NET SDK 发布仓库
6 |
7 | ## 添加 SDK
8 |
9 | 我们提供 Nuget 的集成方式,您可以在工程的 csproj 文件里添加:
10 |
11 | ```
12 |
13 | ```
14 |
15 | 如果是用 .Net CLI,请使用如下命令安装:
16 |
17 | ```
18 | dotnet add package Tencent.QCloud.Cos.Sdk
19 | ```
20 |
21 | 如果是用于目标框架 .Net Framework 4.0 及以下版本的开发,
22 |
23 | 请使用 [Releases](https://github.com/tencentyun/qcloud-sdk-dotnet/releases) 下载的COSXML-Compatible.dll文件
24 |
25 | 在Visual Studio项目中选择
26 |
27 | ```
28 | 项目 -> 添加引用 -> 浏览 -> COSXML-Compatible.dll 的方式添加C# SDK
29 | ```
30 |
31 | 您也可以在 [Releases 里面](https://github.com/tencentyun/qcloud-sdk-dotnet/releases) 手动下载我们的SDK。
32 |
33 | ## 开发文档
34 |
35 | 如果您想要查看每个 API, SDK 是如何调用的,请参考 [腾讯云官网文档](https://cloud.tencent.com/document/product/436/32819)。
36 |
37 | ## License
38 |
39 | 腾讯云 .NET SDK 通过 `MIT ` License 发布。
40 |
41 | ```shell
42 | Copyright (c) 2018 腾讯云
43 |
44 | Permission is hereby granted, free of charge, to any person obtaining a copy
45 | of this software and associated documentation files (the "Software"), to deal
46 | in the Software without restriction, including without limitation the rights
47 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
48 | copies of the Software, and to permit persons to whom the Software is
49 | furnished to do so, subject to the following conditions:
50 |
51 | The above copyright notice and this permission notice shall be included in all
52 | copies or substantial portions of the Software.
53 |
54 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
55 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
56 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
57 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
58 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
59 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
60 | SOFTWARE.
61 | ```
62 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Tag/RefererConfiguration.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Serialization;
3 | using System.Text;
4 | using System.Collections.Generic;
5 |
6 | namespace COSXML.Model.Tag
7 | {
8 | [XmlRoot("RefererConfiguration")]
9 | public sealed class RefererConfiguration
10 | {
11 | [XmlElement("Status")]
12 | public string Status;
13 |
14 | [XmlElement("RefererType")]
15 | public string RefererType;
16 |
17 | [XmlElement("DomainList")]
18 | public DomainList domainList;
19 |
20 | [XmlElement("EmptyReferConfiguration")]
21 | public string EmptyReferConfiguration;
22 |
23 | public string GetInfo()
24 | {
25 | StringBuilder stringBuilder = new StringBuilder("{RefererConfiguration:\n");
26 |
27 | stringBuilder.Append("Status:").Append(Status).Append("\n");
28 | stringBuilder.Append("RefererType:").Append(RefererType).Append("\n");
29 | if (domainList != null)
30 | {
31 | stringBuilder.Append(domainList.GetInfo());
32 | }
33 | if(EmptyReferConfiguration == null)
34 | {
35 | stringBuilder.Append("EmptyReferConfiguration:").Append(EmptyReferConfiguration).Append("\n");
36 | }
37 | stringBuilder.Append("}");
38 | return stringBuilder.ToString();
39 | }
40 | }
41 |
42 | public sealed class DomainList
43 | {
44 | [XmlElement("Domain")]
45 | public List domains;
46 |
47 | public DomainList()
48 | {
49 | this.domains = new List();
50 | }
51 |
52 | public void AddDomain(string domain)
53 | {
54 | domains.Add(domain);
55 | }
56 |
57 | public string GetInfo()
58 | {
59 | StringBuilder stringBuilder = new StringBuilder("{DomainList:\n");
60 | foreach (var domain in domains)
61 | {
62 | stringBuilder.Append("Domain:").Append(domain).Append("\n");
63 | }
64 | stringBuilder.Append("}");
65 | return stringBuilder.ToString();
66 | }
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/GetObjectBytesRequest.cs:
--------------------------------------------------------------------------------
1 |
2 |
3 | using COSXML.Common;
4 | using System;
5 |
6 | namespace COSXML.Model.Object
7 | {
8 | public sealed class GetObjectBytesRequest : ObjectRequest
9 | {
10 | ///
11 | /// 下载进度回调
12 | ///
13 | private COSXML.Callback.OnProgressCallback progressCallback;
14 |
15 | public GetObjectBytesRequest(string bucket, string key) : base(bucket, key)
16 | {
17 | this.method = CosRequestMethod.GET;
18 | }
19 |
20 | ///
21 | /// 下载进度回调
22 | ///
23 | ///
24 | public void SetCosProgressCallback(COSXML.Callback.OnProgressCallback progressCallback)
25 | {
26 | this.progressCallback = progressCallback;
27 | }
28 |
29 | internal COSXML.Callback.OnProgressCallback GetCosProgressCallback()
30 | {
31 |
32 | return progressCallback;
33 | }
34 |
35 | ///
36 | /// 下载内容范围
37 | ///
38 | ///
39 | ///
40 | public void SetRange(long start, long end)
41 | {
42 |
43 | if (start < 0)
44 | {
45 |
46 | return;
47 | }
48 |
49 | if (end < start)
50 | {
51 | end = -1;
52 | }
53 |
54 | SetRequestHeader(CosRequestHeaderKey.RANGE, String.Format("bytes={0}-{1}", start,
55 | (end == -1 ? "" : end.ToString())));
56 |
57 | }
58 |
59 | ///
60 | /// 下载内容的起始偏移量
61 | ///
62 | ///
63 | public void SetRange(long start)
64 | {
65 | SetRange(start, -1);
66 | }
67 |
68 | ///
69 | /// 下载特定版本的对象
70 | ///
71 | ///
72 | public void SetVersionId(string versionId)
73 | {
74 |
75 | if (versionId != null)
76 | {
77 | SetQueryParameter(CosRequestHeaderKey.VERSION_ID, versionId);
78 | }
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXMLTests/ObsoleteAsyncTest.cs:
--------------------------------------------------------------------------------
1 | using COSXML.Common;
2 | using COSXML.CosException;
3 | using COSXML.Model;
4 | using COSXML.Model.Bucket;
5 | using COSXML.Model.Tag;
6 | using COSXML.Utils;
7 | using NUnit.Framework;
8 | using System;
9 | using System.Collections.Generic;
10 | using System.Text;
11 | using System.Threading;
12 |
13 | namespace COSXMLTests
14 | {
15 |
16 | [TestFixture()]
17 | public class ObsoleteAsyncTest
18 | {
19 |
20 | [Test()]
21 | public void AsyncGetBucket()
22 | {
23 | ManualResetEvent manualResetEvent = new ManualResetEvent(false);
24 |
25 | GetBucketRequest request = new GetBucketRequest(QCloudServer.Instance().bucketForObjectTest);
26 |
27 | ///执行请求
28 | QCloudServer.Instance().cosXml.GetBucket(request,
29 | delegate (CosResult cosResult)
30 | {
31 | GetBucketResult result = cosResult as GetBucketResult;
32 |
33 | Assert.True(result.httpCode == 200);
34 | manualResetEvent.Set();
35 | },
36 |
37 | delegate (CosClientException clientEx, CosServerException serverEx)
38 | {
39 |
40 | if (clientEx != null)
41 | {
42 | Console.WriteLine("CosClientException: " + clientEx.Message);
43 | }
44 |
45 | if (serverEx != null)
46 | {
47 | Console.WriteLine("CosServerException: " + serverEx.GetInfo());
48 | }
49 |
50 | Assert.Fail();
51 | manualResetEvent.Set();
52 | }
53 | );
54 |
55 | manualResetEvent.WaitOne();
56 |
57 | }
58 |
59 | [Test()]
60 | public void TestSetSign()
61 | {
62 | GetBucketRequest request = new GetBucketRequest(QCloudServer.Instance().bucketForObjectTest);
63 | request.SetSign(TimeUtils.GetCurrentTime(TimeUnit.Seconds), 600);
64 |
65 | ///执行请求
66 | GetBucketResult result = QCloudServer.Instance().cosXml.GetBucket(request);
67 | Assert.AreEqual(result.httpCode, 200);
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/HeadObjectResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 |
6 | namespace COSXML.Model.Object
7 | {
8 | ///
9 | /// 检索对象返回的结果
10 | ///
11 | ///
12 | public sealed class HeadObjectResult : CosResult
13 | {
14 |
15 | ///
16 | /// Object 的存储级别,枚举值:STANDARD,STANDARD_IA
17 | ///
18 | ///
19 | public string cosStorageClass;
20 |
21 | ///
22 | /// 对象的长度
23 | ///
24 | public long size;
25 |
26 | ///
27 | /// 对象的eTag
28 | ///
29 | public string eTag;
30 |
31 | ///
32 | /// 对象的 crc64ecma
33 | ///
34 | public string crc64ecma;
35 |
36 | ///
37 | /// 对象的 lastModified
38 | ///
39 | public string lastModified;
40 |
41 | internal override void InternalParseResponseHeaders()
42 | {
43 | List values;
44 |
45 | this.responseHeaders.TryGetValue("x-cos-storage-class", out values);
46 |
47 | if (values != null && values.Count > 0)
48 | {
49 | cosStorageClass = values[0];
50 | }
51 |
52 | this.responseHeaders.TryGetValue("Content-Length", out values);
53 |
54 | if (values != null && values.Count > 0)
55 | {
56 | long.TryParse(values[0], out size);
57 | }
58 |
59 | this.responseHeaders.TryGetValue("ETag", out values);
60 |
61 | if (values != null && values.Count > 0)
62 | {
63 | eTag = values[0];
64 | }
65 |
66 | this.responseHeaders.TryGetValue("x-cos-hash-crc64ecma", out values);
67 |
68 | if (values != null && values.Count > 0)
69 | {
70 | crc64ecma = values[0];
71 | }
72 |
73 | this.responseHeaders.TryGetValue("Last-Modified", out values);
74 |
75 | if (values != null && values.Count > 0)
76 | {
77 | lastModified = values[0];
78 | }
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketLifecycleRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Model.Tag;
7 | using COSXML.Network;
8 | using COSXML.CosException;
9 |
10 | namespace COSXML.Model.Bucket
11 | {
12 | ///
13 | /// 设置 Bucket 生命周期
14 | ///
15 | ///
16 | public sealed class PutBucketLifecycleRequest : BucketRequest
17 | {
18 | private LifecycleConfiguration lifecycleConfiguration;
19 |
20 | public PutBucketLifecycleRequest(string bucket)
21 | : base(bucket)
22 | {
23 | this.method = CosRequestMethod.PUT;
24 | this.queryParameters.Add("lifecycle", null);
25 | lifecycleConfiguration = new LifecycleConfiguration();
26 | lifecycleConfiguration.rules = new List();
27 | }
28 |
29 | public override Network.RequestBody GetRequestBody()
30 | {
31 | return GetXmlRequestBody(lifecycleConfiguration);
32 | }
33 |
34 | ///
35 | /// 设置生命周期规则
36 | ///
37 | ///
38 | ///
39 | public void SetRule(LifecycleConfiguration.Rule rule)
40 | {
41 |
42 | if (rule != null)
43 | {
44 | lifecycleConfiguration.rules.Add(rule);
45 | }
46 | }
47 |
48 | ///
49 | /// 设置生命周期规则
50 | ///
51 | ///
52 | ///
53 | public void SetRules(List rules)
54 | {
55 |
56 | if (rules != null)
57 | {
58 | lifecycleConfiguration.rules.AddRange(rules);
59 | }
60 | }
61 |
62 | public override void CheckParameters()
63 | {
64 | base.CheckParameters();
65 |
66 | if (lifecycleConfiguration.rules.Count == 0)
67 | {
68 | throw new CosClientException((int)CosClientError.InvalidArgument, "lifecycleConfiguration.rules.Count = 0");
69 | }
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXMLDemo/Bucket/HeadBucket.cs:
--------------------------------------------------------------------------------
1 | using COSXML;
2 | using COSXML.Auth;
3 | using COSXML.Model.Bucket;
4 |
5 | namespace COSXMLDemo
6 | {
7 | public class HeadBucketModel
8 | {
9 | public CosXml cosXml;
10 |
11 | // 初始化COS服务实例
12 | private void InitCosXml()
13 | {
14 | string region = Environment.GetEnvironmentVariable("COS_REGION");
15 | CosXmlConfig config = new CosXmlConfig.Builder()
16 | .SetRegion(region) // 设置默认的地域, COS 地域的简称请参照 https://cloud.tencent.com/document/product/436/6224
17 | .Build();
18 | string secretId = Environment.GetEnvironmentVariable("SECRET_ID"); // 云 API 密钥 SecretId, 获取 API 密钥请参照 https://console.cloud.tencent.com/cam/capi
19 | string secretKey = Environment.GetEnvironmentVariable("SECRET_KEY"); // 云 API 密钥 SecretKey, 获取 API 密钥请参照 https://console.cloud.tencent.com/cam/capi
20 | long durationSecond = 600; //每次请求签名有效时长,单位为秒
21 | QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond);
22 | this.cosXml = new CosXmlServer(config, qCloudCredentialProvider);
23 | }
24 |
25 | HeadBucketModel()
26 | {
27 | InitCosXml();
28 | }
29 |
30 | public void HeadBucket()
31 | {
32 | try
33 | {
34 | // 存储桶名称,此处填入格式必须为 BucketName-APPID, 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
35 | string bucket = "examplebucket-1250000000";
36 | HeadBucketRequest request = new HeadBucketRequest(bucket);
37 | //执行请求
38 | HeadBucketResult result = cosXml.HeadBucket(request);
39 | //请求成功
40 | Console.WriteLine(result.GetResultInfo());
41 | }
42 | catch (COSXML.CosException.CosClientException clientEx)
43 | {
44 | Console.WriteLine("CosClientException: " + clientEx);
45 | }
46 | catch (COSXML.CosException.CosServerException serverEx)
47 | {
48 | Console.WriteLine("CosServerException: " + serverEx.GetInfo());
49 | }
50 | }
51 |
52 | public static void HeadBucketModelMain()
53 | {
54 | HeadBucketModel m = new HeadBucketModel();
55 | m.HeadBucket();
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXMLDemo/Bucket/DeleteBucket.cs:
--------------------------------------------------------------------------------
1 | using COSXML;
2 | using COSXML.Auth;
3 | using COSXML.Model.Bucket;
4 | namespace COSXMLDemo
5 | {
6 | public class DeleteBucketModel
7 | {
8 | public CosXml cosXml;
9 |
10 | // 初始化COS服务实例
11 | private void InitCosXml()
12 | {
13 | string region = Environment.GetEnvironmentVariable("COS_REGION");
14 | CosXmlConfig config = new CosXmlConfig.Builder()
15 | .SetRegion(region) // 设置默认的地域, COS 地域的简称请参照 https://cloud.tencent.com/document/product/436/6224
16 | .Build();
17 | string secretId = Environment.GetEnvironmentVariable("SECRET_ID"); // 云 API 密钥 SecretId, 获取 API 密钥请参照 https://console.cloud.tencent.com/cam/capi
18 | string secretKey = Environment.GetEnvironmentVariable("SECRET_KEY"); // 云 API 密钥 SecretKey, 获取 API 密钥请参照 https://console.cloud.tencent.com/cam/capi
19 | long durationSecond = 600; //每次请求签名有效时长,单位为秒
20 | QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond);
21 | this.cosXml = new CosXmlServer(config, qCloudCredentialProvider);
22 | }
23 |
24 | DeleteBucketModel()
25 | {
26 | InitCosXml();
27 | }
28 |
29 | public void DeleteBucket()
30 | {
31 | try
32 | {
33 | // 存储桶名称,此处填入格式必须为 BucketName-APPID, 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
34 | string bucket = "examplebucketned-1253960454";
35 | DeleteBucketRequest request = new DeleteBucketRequest(bucket);
36 | //执行请求
37 | DeleteBucketResult result = cosXml.DeleteBucket(request);
38 | //请求成功
39 | Console.WriteLine(result.GetResultInfo());
40 | }
41 | catch (COSXML.CosException.CosClientException clientEx)
42 | {
43 | Console.WriteLine("CosClientException: " + clientEx);
44 | }
45 | catch (COSXML.CosException.CosServerException serverEx)
46 | {
47 | Console.WriteLine("CosServerException: " + serverEx.GetInfo());
48 | }
49 | }
50 |
51 | public static void DeleteObjectModelMain()
52 | {
53 | DeleteBucketModel m = new DeleteBucketModel();
54 | m.DeleteBucket();
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXMLDemo/Bucket/DoesBucketExist.cs:
--------------------------------------------------------------------------------
1 | using COSXML;
2 | using COSXML.Auth;
3 | using COSXML.Model.Bucket;
4 |
5 | namespace COSXMLDemo
6 | {
7 | public class DoesBucketExistModel
8 | {
9 | public CosXml cosXml;
10 |
11 | // 初始化COS服务实例
12 | private void InitCosXml()
13 | {
14 | string region = Environment.GetEnvironmentVariable("COS_REGION");
15 | CosXmlConfig config = new CosXmlConfig.Builder()
16 | .SetRegion(region) // 设置默认的地域, COS 地域的简称请参照 https://cloud.tencent.com/document/product/436/6224
17 | .Build();
18 | string secretId = Environment.GetEnvironmentVariable("SECRET_ID"); // 云 API 密钥 SecretId, 获取 API 密钥请参照 https://console.cloud.tencent.com/cam/capi
19 | string secretKey = Environment.GetEnvironmentVariable("SECRET_KEY"); // 云 API 密钥 SecretKey, 获取 API 密钥请参照 https://console.cloud.tencent.com/cam/capi
20 | long durationSecond = 600; //每次请求签名有效时长,单位为秒
21 | QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond);
22 | this.cosXml = new CosXmlServer(config, qCloudCredentialProvider);
23 | }
24 |
25 | DoesBucketExistModel()
26 | {
27 | InitCosXml();
28 | }
29 |
30 | public void DoesBucketExist()
31 | {
32 | try
33 | {
34 | // 存储桶名称,此处填入格式必须为 BucketName-APPID, 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
35 | string bucket = "examplebucket-1250000000";
36 | DoesBucketExistRequest request = new DoesBucketExistRequest(bucket);
37 | //执行请求
38 | bool existState = cosXml.DoesBucketExist(request);
39 | //请求成功
40 | Console.WriteLine("bucket exist state is: " + existState);
41 | }
42 | catch (COSXML.CosException.CosClientException clientEx)
43 | {
44 | Console.WriteLine("CosClientException: " + clientEx);
45 | }
46 | catch (COSXML.CosException.CosServerException serverEx)
47 | {
48 | Console.WriteLine("CosServerException: " + serverEx.GetInfo());
49 | }
50 | }
51 |
52 | public static void DoesBucketExistModelMain()
53 | {
54 | DoesBucketExistModel m = new DoesBucketExistModel();
55 | m.DoesBucketExist();
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/PutBucketCORSRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Model.Tag;
7 | using COSXML.Network;
8 | using COSXML.CosException;
9 |
10 | namespace COSXML.Model.Bucket
11 | {
12 | ///
13 | /// 设置 Bucket CORS
14 | ///
15 | ///
16 | public sealed class PutBucketCORSRequest : BucketRequest
17 | {
18 | ///
19 | /// CORS 配置信息
20 | ///
21 | ///
22 | private CORSConfiguration corsConfiguration;
23 |
24 | public PutBucketCORSRequest(string bucket)
25 | : base(bucket)
26 | {
27 | this.method = CosRequestMethod.PUT;
28 | this.queryParameters.Add("cors", null);
29 | corsConfiguration = new CORSConfiguration();
30 | corsConfiguration.corsRules = new List();
31 | }
32 |
33 | public override Network.RequestBody GetRequestBody()
34 | {
35 | return GetXmlRequestBody(corsConfiguration);
36 | }
37 |
38 | ///
39 | /// 设置 CORS 规则
40 | ///
41 | ///
42 | ///
43 | public void SetCORSRule(CORSConfiguration.CORSRule corsRule)
44 | {
45 |
46 | if (corsRule != null)
47 | {
48 | corsConfiguration.corsRules.Add(corsRule);
49 | }
50 | }
51 |
52 | ///
53 | /// 设置 CORS 规则
54 | ///
55 | ///
56 | ///
57 | public void SetCORSRules(List corsRules)
58 | {
59 |
60 | if (corsRules != null)
61 | {
62 | corsConfiguration.corsRules.AddRange(corsRules);
63 | }
64 | }
65 |
66 | public override void CheckParameters()
67 | {
68 | base.CheckParameters();
69 |
70 | if (corsConfiguration.corsRules.Count == 0)
71 | {
72 | throw new CosClientException((int)CosClientError.InvalidArgument, "corsConfiguration.corsRules.Count = 0");
73 | }
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXMLDemo/Bucket/ListBucket.cs:
--------------------------------------------------------------------------------
1 | using COSXML;
2 | using COSXML.Auth;
3 | using COSXML.Model.Service;
4 | using COSXML.Model.Tag;
5 |
6 | namespace COSXMLDemo
7 | {
8 | public class ListBucketModel
9 | {
10 | public CosXml cosXml;
11 |
12 | // 初始化COS服务实例
13 | private void InitCosXml()
14 | {
15 | string region = Environment.GetEnvironmentVariable("COS_REGION");
16 | CosXmlConfig config = new CosXmlConfig.Builder()
17 | .SetRegion(region) // 设置默认的地域, COS 地域的简称请参照 https://cloud.tencent.com/document/product/436/6224
18 | .Build();
19 | string secretId = Environment.GetEnvironmentVariable("SECRET_ID"); // 云 API 密钥 SecretId, 获取 API 密钥请参照 https://console.cloud.tencent.com/cam/capi
20 | string secretKey = Environment.GetEnvironmentVariable("SECRET_KEY"); // 云 API 密钥 SecretKey, 获取 API 密钥请参照 https://console.cloud.tencent.com/cam/capi
21 | long durationSecond = 600; //每次请求签名有效时长,单位为秒
22 | QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond);
23 | this.cosXml = new CosXmlServer(config, qCloudCredentialProvider);
24 | }
25 |
26 | ListBucketModel()
27 | {
28 | InitCosXml();
29 | }
30 |
31 | public void GetService()
32 | {
33 | try
34 | {
35 | GetServiceRequest request = new GetServiceRequest();
36 | //执行请求
37 | GetServiceResult result = cosXml.GetService(request);
38 | //得到所有的 buckets
39 | List allBuckets = result.listAllMyBuckets.buckets;
40 | foreach (var bucket in allBuckets)
41 | {
42 | Console.WriteLine(bucket.name);
43 | }
44 | }
45 | catch (COSXML.CosException.CosClientException clientEx)
46 | {
47 | Console.WriteLine("CosClientException: " + clientEx);
48 | }
49 | catch (COSXML.CosException.CosServerException serverEx)
50 | {
51 | Console.WriteLine("CosServerException: " + serverEx.GetInfo());
52 | }
53 | }
54 |
55 | public static void ListBucketModelMain()
56 | {
57 | ListBucketModel m = new ListBucketModel();
58 | m.GetService();
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/PutObjectACLRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.Utils;
7 | using COSXML.Model.Tag;
8 |
9 | namespace COSXML.Model.Object
10 | {
11 | ///
12 | /// 设置 对象 的ACL
13 | ///
14 | ///
15 | public sealed class PutObjectACLRequest : ObjectRequest
16 | {
17 | public PutObjectACLRequest(string bucket, string key)
18 | : base(bucket, key)
19 | {
20 | this.method = CosRequestMethod.PUT;
21 | this.queryParameters.Add("acl", null);
22 | }
23 |
24 | ///
25 | /// 定义 Object 的 acl 属性。有效值:private,public-read-write,public-read;默认值:private
26 | ///
27 | ///
28 | ///
29 | public void SetCosACL(string cosACL)
30 | {
31 |
32 | if (cosACL != null)
33 | {
34 | SetRequestHeader(CosRequestHeaderKey.X_COS_ACL, cosACL);
35 | }
36 | }
37 |
38 | ///
39 | /// 定义 Object 的 acl 属性。有效值:private,public-read-write,public-read;默认值:private
40 | ///
41 | ///
42 | ///
43 | public void SetCosACL(CosACL cosACL)
44 | {
45 | SetCosACL(EnumUtils.GetValue(cosACL));
46 | }
47 |
48 | ///
49 | /// 赋予被授权者读的权限
50 | ///
51 | ///
52 | ///
53 | public void SetXCosGrantRead(GrantAccount grantAccount)
54 | {
55 |
56 | if (grantAccount != null)
57 | {
58 | SetRequestHeader(CosRequestHeaderKey.X_COS_GRANT_READ, grantAccount.GetGrantAccounts());
59 | }
60 | }
61 |
62 | ///
63 | /// 赋予被授权者所有的权限
64 | ///
65 | ///
66 | ///
67 | public void SetXCosReadWrite(GrantAccount grantAccount)
68 | {
69 |
70 | if (grantAccount != null)
71 | {
72 | SetRequestHeader(CosRequestHeaderKey.X_COS_GRANT_FULL_CONTROL, grantAccount.GetGrantAccounts());
73 | }
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXMLDemo/CI/DescribeDocProcessJob.cs:
--------------------------------------------------------------------------------
1 | using COSXML;
2 | using COSXML.Auth;
3 | using COSXML.Model.CI;
4 | namespace COSXMLDemo
5 | {
6 | public class DescribeDocProcessJobModel
7 | {
8 |
9 | public CosXml cosXml;
10 |
11 | // 初始化COS服务实例
12 | private void InitCosXml()
13 | {
14 | string region = Environment.GetEnvironmentVariable("COS_REGION");
15 | CosXmlConfig config = new CosXmlConfig.Builder()
16 | .SetRegion(region) // 设置默认的地域, COS 地域的简称请参照 https://cloud.tencent.com/document/product/436/6224
17 | .Build();
18 | string secretId = Environment.GetEnvironmentVariable("SECRET_ID"); // 云 API 密钥 SecretId, 获取 API 密钥请参照 https://console.cloud.tencent.com/cam/capi
19 | string secretKey = Environment.GetEnvironmentVariable("SECRET_KEY"); // 云 API 密钥 SecretKey, 获取 API 密钥请参照 https://console.cloud.tencent.com/cam/capi
20 | long durationSecond = 600; //每次请求签名有效时长,单位为秒
21 | QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond);
22 | this.cosXml = new CosXmlServer(config, qCloudCredentialProvider);
23 | }
24 |
25 | DescribeDocProcessJobModel()
26 | {
27 | InitCosXml();
28 | }
29 |
30 | public void DescribeDocProcessJob()
31 | {
32 | try
33 | {
34 | string bucket = "bucketname-APPID";
35 | string jobId = "";
36 | DescribeDocProcessJobRequest describeDocProcessJobRequest = new DescribeDocProcessJobRequest(bucket, jobId);
37 | DescribeDocProcessJobResult describeDocProcessJobResult = cosXml.DescribeDocProcessJob(describeDocProcessJobRequest);
38 |
39 | Console.WriteLine(describeDocProcessJobResult.taskDocProcessResult.JobsDetail.JobId);
40 | }
41 | catch (COSXML.CosException.CosClientException clientEx)
42 | {
43 | Console.WriteLine("CosClientException: " + clientEx);
44 | }
45 | catch (COSXML.CosException.CosServerException serverEx)
46 | {
47 | Console.WriteLine("CosServerException: " + serverEx.GetInfo());
48 | }
49 | }
50 |
51 | public static void DescribeDocProcessJobModelMain()
52 | {
53 | DescribeDocProcessJobModel m = new DescribeDocProcessJobModel();
54 | m.DescribeDocProcessJob();
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/CI/GetSnapshotRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using System.IO;
6 | using COSXML.Common;
7 | using COSXML.Model.Object;
8 | using COSXML.CosException;
9 |
10 | namespace COSXML.Model.CI
11 | {
12 | ///
13 | /// 媒体截图
14 | ///
15 | ///
16 | public sealed class GetSnapshotRequest : ObjectRequest
17 | {
18 | private string localFilePath;
19 |
20 | public GetSnapshotRequest(string bucket, string key,
21 | float time, string localFilePath,
22 | int width = 0, int height = 0, string format = "jpg",
23 | string rotate = "auto", string mode = "exactframe"
24 | )
25 | : base(bucket, key)
26 | {
27 |
28 | if (time < 0)
29 | {
30 | throw new CosClientException((int)CosClientError.InvalidArgument, "time less than 0");
31 | }
32 |
33 | this.method = CosRequestMethod.GET;
34 | this.queryParameters.Add("ci-process", "snapshot");
35 | this.queryParameters.Add("time", time.ToString());
36 | if (width != 0)
37 | {
38 | this.queryParameters.Add("width", width.ToString());
39 | }
40 | if (height != 0)
41 | {
42 | this.queryParameters.Add("height", height.ToString());
43 | }
44 | if (format != "jpg")
45 | {
46 | this.queryParameters.Add("format", format);
47 | }
48 | if (rotate != "auto")
49 | {
50 | this.queryParameters.Add("rotate", rotate);
51 | }
52 | if (mode != "exactframe")
53 | {
54 | this.queryParameters.Add("mode", mode);
55 | }
56 |
57 | this.localFilePath = localFilePath;
58 | this.CheckParameters();
59 | }
60 |
61 | public override void CheckParameters()
62 | {
63 | if (localFilePath == null)
64 | {
65 | throw new CosClientException((int)CosClientError.InvalidArgument, "localFileName = null");
66 | }
67 |
68 | base.CheckParameters();
69 | }
70 |
71 | ///
72 | /// 获取本地文件保存路径
73 | ///
74 | ///
75 | public string GetSaveFilePath()
76 | {
77 | return localFilePath;
78 | }
79 |
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXMLDemo/Bucket/CreateBucket.cs:
--------------------------------------------------------------------------------
1 | using COSXML;
2 | using COSXML.Auth;
3 | using COSXML.Model.Bucket;
4 | namespace COSXMLDemo
5 | {
6 | public class CreateBucketModel
7 | {
8 |
9 | public CosXml cosXml;
10 |
11 | // 初始化COS服务实例
12 | private void InitCosXml()
13 | {
14 | string region = Environment.GetEnvironmentVariable("COS_REGION");
15 | CosXmlConfig config = new CosXmlConfig.Builder()
16 | .SetRegion(region) // 设置默认的地域, COS 地域的简称请参照 https://cloud.tencent.com/document/product/436/6224
17 | .Build();
18 | string secretId = Environment.GetEnvironmentVariable("SECRET_ID"); // 云 API 密钥 SecretId, 获取 API 密钥请参照 https://console.cloud.tencent.com/cam/capi
19 | string secretKey = Environment.GetEnvironmentVariable("SECRET_KEY"); // 云 API 密钥 SecretKey, 获取 API 密钥请参照 https://console.cloud.tencent.com/cam/capi
20 | long durationSecond = 600; //每次请求签名有效时长,单位为秒
21 | QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond);
22 | this.cosXml = new CosXmlServer(config, qCloudCredentialProvider);
23 | }
24 |
25 | CreateBucketModel()
26 | {
27 | InitCosXml();
28 | }
29 |
30 | public void PutBucket()
31 | {
32 | try
33 | {
34 | // 存储桶名称,此处填入格式必须为 BucketName-APPID, 其中 APPID 获取参考 https://console.cloud.tencent.com/developer
35 | string bucket = "examplebucket-1250000000";
36 | PutBucketRequest request = new PutBucketRequest(bucket);
37 | request.SetCosACL("private"); //定义 Object 的 acl 属性。有效值:private,public-read-write,public-read;默认值:private
38 | //执行请求
39 | PutBucketResult result = cosXml.PutBucket(request);
40 | //请求成功
41 | Console.WriteLine(result.GetResultInfo());
42 | }
43 | catch (COSXML.CosException.CosClientException clientEx)
44 | {
45 | Console.WriteLine("CosClientException: " + clientEx);
46 | }
47 | catch (COSXML.CosException.CosServerException serverEx)
48 | {
49 | Console.WriteLine("CosServerException: " + serverEx.GetInfo());
50 | }
51 | }
52 |
53 | public static void CreateBucketModelMain()
54 | {
55 | CreateBucketModel m = new CreateBucketModel();
56 | m.PutBucket();
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Object/ListPartsRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 | using COSXML.CosException;
7 |
8 | namespace COSXML.Model.Object
9 | {
10 | ///
11 | /// 查询特定分块上传中的已上传的块
12 | ///
13 | ///
14 | public sealed class ListPartsRequest : ObjectRequest
15 | {
16 | ///
17 | /// 标识本次分块上传的 ID
18 | ///
19 | private string uploadId;
20 |
21 | public ListPartsRequest(string bucket, string key, string uploadId)
22 | : base(bucket, key)
23 | {
24 | this.method = CosRequestMethod.GET;
25 | this.uploadId = uploadId;
26 | }
27 |
28 | ///
29 | /// 单次返回最大的条目数量,默认 1000
30 | ///
31 | ///
32 | public void SetMaxParts(int maxParts)
33 | {
34 | SetQueryParameter(CosRequestHeaderKey.MAX_PARTS, maxParts.ToString());
35 | }
36 |
37 | ///
38 | /// 默认以 UTF-8 二进制顺序列出条目,所有列出条目从 marker 开始
39 | ///
40 | ///
41 | public void SetPartNumberMarker(int partNumberMarker)
42 | {
43 | SetQueryParameter(CosRequestHeaderKey.PART_NUMBER_MARKER, partNumberMarker.ToString());
44 | }
45 |
46 | ///
47 | /// 规定返回值的编码方式
48 | ///
49 | ///
50 | public void SetEncodingType(string encodingType)
51 | {
52 | SetQueryParameter(CosRequestHeaderKey.ENCODING_TYPE, encodingType);
53 | }
54 |
55 | public override void CheckParameters()
56 | {
57 |
58 | if (requestUrlWithSign != null)
59 | {
60 |
61 | return;
62 | }
63 |
64 | base.CheckParameters();
65 |
66 | if (uploadId == null)
67 | {
68 | throw new CosClientException((int)CosClientError.InvalidArgument, "uploadId = null");
69 | }
70 | }
71 |
72 | protected override void InternalUpdateQueryParameters()
73 | {
74 |
75 | try
76 | {
77 | queryParameters.Add("uploadId", uploadId);
78 | }
79 | catch (ArgumentException)
80 | {
81 | queryParameters["uploadId"] = uploadId;
82 | }
83 |
84 | }
85 |
86 |
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXML/Model/Bucket/GetBucketRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using System.Text;
5 | using COSXML.Common;
6 |
7 | namespace COSXML.Model.Bucket
8 | {
9 | ///
10 | /// 获取 Bucket 中对象列表
11 | ///
12 | ///
13 | public sealed class GetBucketRequest : BucketRequest
14 | {
15 | public GetBucketRequest(string bucket)
16 | : base(bucket)
17 | {
18 | this.method = CosRequestMethod.GET;
19 | this.queryParameters.Add("max-keys", 1000.ToString());
20 | }
21 |
22 | ///
23 | /// 前缀匹配,用来规定返回的文件前缀地址
24 | ///
25 | ///
26 | public void SetPrefix(string prefix)
27 | {
28 |
29 | if (prefix != null)
30 | {
31 | SetQueryParameter("prefix", prefix);
32 | }
33 | }
34 |
35 | ///
36 | /// 定界符为一个符号,
37 | /// 如果有 Prefix,则将 Prefix 到 delimiter 之间的相同路径归为一类,定义为 Common Prefix,然后列出所有 Common Prefix。
38 | /// 如果没有 Prefix,则从路径起点开始
39 | ///
40 | ///
41 | public void SetDelimiter(string delimiter)
42 | {
43 |
44 | if (delimiter != null)
45 | {
46 | SetQueryParameter("delimiter", delimiter);
47 | }
48 | }
49 |
50 | ///
51 | /// 规定返回值的编码方式,可选值:url
52 | ///
53 | ///
54 | public void SetEncodingType(string encodingType)
55 | {
56 |
57 | if (encodingType != null)
58 | {
59 | SetQueryParameter("encoding-type", encodingType);
60 | }
61 | }
62 |
63 | ///
64 | /// 默认以 UTF-8 二进制顺序列出条目,所有列出条目从 marker 开始
65 | ///
66 | ///
67 | public void SetMarker(string marker)
68 | {
69 |
70 | if (marker != null)
71 | {
72 | SetQueryParameter("marker", marker);
73 | }
74 | }
75 |
76 | ///
77 | /// 单次返回最大的条目数量,默认 1000
78 | ///
79 | ///
80 | public void SetMaxKeys(string maxKeys)
81 | {
82 |
83 | if (maxKeys != null)
84 | {
85 | SetQueryParameter("max-keys", maxKeys);
86 | }
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/QCloudCSharpSDK/COSXMLDemo/CI/DescribeFileZipProcessJobs.cs:
--------------------------------------------------------------------------------
1 | using COSXML;
2 | using COSXML.Auth;
3 | using COSXML.Model.CI;
4 |
5 | namespace COSXMLDemo
6 | {
7 | public class DescribeFileZipProcessJobsModel
8 | {
9 |
10 | public CosXml cosXml;
11 |
12 | // 初始化COS服务实例
13 | private void InitCosXml()
14 | {
15 | string region = Environment.GetEnvironmentVariable("COS_REGION");
16 | CosXmlConfig config = new CosXmlConfig.Builder()
17 | .SetRegion(region) // 设置默认的地域, COS 地域的简称请参照 https://cloud.tencent.com/document/product/436/6224
18 | .Build();
19 | string secretId = Environment.GetEnvironmentVariable("SECRET_ID"); // 云 API 密钥 SecretId, 获取 API 密钥请参照 https://console.cloud.tencent.com/cam/capi
20 | string secretKey = Environment.GetEnvironmentVariable("SECRET_KEY"); // 云 API 密钥 SecretKey, 获取 API 密钥请参照 https://console.cloud.tencent.com/cam/capi
21 | long durationSecond = 600; //每次请求签名有效时长,单位为秒
22 | QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, durationSecond);
23 | this.cosXml = new CosXmlServer(config, qCloudCredentialProvider);
24 | }
25 |
26 | DescribeFileZipProcessJobsModel()
27 | {
28 | InitCosXml();
29 | }
30 |
31 | public void DescribeFileZipProcessJobs()
32 | {
33 | try
34 | {
35 | string bucket = "bucketname-APPID";
36 | string jobId = "";
37 | DescribeFileZipProcessJobsRequest describeDocProcessJobsRequest = new DescribeFileZipProcessJobsRequest(bucket,jobId);
38 | DescribeFileZipProcessJobsResult describeFileZipProcessJobsResult= cosXml.describeFileZipProcessJobs(describeDocProcessJobsRequest);
39 | Console.WriteLine(describeFileZipProcessJobsResult.describeFileZipProcessJobsResult.JobsDetail.Count);
40 | }
41 | catch (COSXML.CosException.CosClientException clientEx)
42 | {
43 | Console.WriteLine("CosClientException: " + clientEx);
44 | }
45 | catch (COSXML.CosException.CosServerException serverEx)
46 | {
47 | Console.WriteLine("CosServerException: " + serverEx.GetInfo());
48 | }
49 | }
50 |
51 | public static void DescribeFileZipProcessJobsModelMain()
52 | {
53 | DescribeFileZipProcessJobsModel m = new DescribeFileZipProcessJobsModel();
54 | m.DescribeFileZipProcessJobs();
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------