@@ -56,9 +56,9 @@ public async Task<OssResult<ListBucketsResult>> ListBucketsAsync(string region)
5656 /// <param name="key"></param>
5757 /// <param name="file"></param>
5858 /// <returns></returns>
59- public async Task < OssResult < PutObjectResult > > PutObjectAsync ( BucketInfo bucket , string key , RequestContent file )
59+ public async Task < OssResult < PutObjectResult > > PutObjectAsync ( BucketInfo bucket , string key , RequestContent file , IDictionary < string , string > extraHeaders = null )
6060 {
61- var cmd = new PutObjectCommand ( _requestContext , bucket , key , file , null ) ;
61+ var cmd = new PutObjectCommand ( _requestContext , bucket , key , file , extraHeaders ) ;
6262
6363 return await cmd . ExecuteAsync ( ) ;
6464 }
@@ -71,16 +71,17 @@ public async Task<OssResult<PutObjectResult>> PutObjectAsync(BucketInfo bucket,
7171 /// <param name="content"></param>
7272 /// <param name="mimeType"></param>
7373 /// <returns></returns>
74- public async Task < OssResult < PutObjectResult > > PutObjectAsync ( BucketInfo bucket , string key , string content , string mimeType = "text/plain" )
74+ public async Task < OssResult < PutObjectResult > > PutObjectAsync ( BucketInfo bucket , string key , string content , string mimeType = "text/plain" , ObjectMetadata meta = null , IDictionary < string , string > extraHeaders = null )
7575 {
7676 var file = new RequestContent ( )
7777 {
7878 ContentType = RequestContentType . String ,
7979 StringContent = content ,
80- MimeType = mimeType
80+ MimeType = mimeType ,
81+ Metadata = meta
8182 } ;
8283
83- return await PutObjectAsync ( bucket , key , file ) ;
84+ return await PutObjectAsync ( bucket , key , file , extraHeaders ) ;
8485 }
8586
8687 /// <summary>
@@ -91,18 +92,19 @@ public async Task<OssResult<PutObjectResult>> PutObjectAsync(BucketInfo bucket,
9192 /// <param name="filePathName"></param>
9293 /// <returns></returns>
9394 public async Task < OssResult < PutObjectResult > > PutObjectByFileNameAsync ( BucketInfo bucket , string key ,
94- string filePathName )
95+ string filePathName , ObjectMetadata meta = null , IDictionary < string , string > extraHeaders = null )
9596 {
9697 using ( var stream = File . OpenRead ( filePathName ) )
9798 {
9899 var file = new RequestContent ( )
99100 {
100101 ContentType = RequestContentType . Stream ,
101102 StreamContent = stream ,
102- MimeType = MimeHelper . GetMime ( filePathName )
103+ MimeType = MimeHelper . GetMime ( filePathName ) ,
104+ Metadata = meta
103105 } ;
104106
105- return await PutObjectAsync ( bucket , key , file ) ;
107+ return await PutObjectAsync ( bucket , key , file , extraHeaders ) ;
106108 }
107109 }
108110
@@ -115,16 +117,17 @@ public async Task<OssResult<PutObjectResult>> PutObjectByFileNameAsync(BucketInf
115117 /// <param name="mimeType"></param>
116118 /// <returns></returns>
117119 public async Task < OssResult < PutObjectResult > > PutObjectAsync ( BucketInfo bucket , string key , Stream content ,
118- string mimeType = "application/octet-stream" )
120+ string mimeType = "application/octet-stream" , ObjectMetadata meta = null , IDictionary < string , string > extraHeaders = null )
119121 {
120122 var file = new RequestContent ( )
121123 {
122124 ContentType = RequestContentType . String ,
123125 StreamContent = content ,
124- MimeType = mimeType
126+ MimeType = mimeType ,
127+ Metadata = meta
125128 } ;
126129
127- return await PutObjectAsync ( bucket , key , file ) ;
130+ return await PutObjectAsync ( bucket , key , file , extraHeaders ) ;
128131 }
129132
130133
0 commit comments