.NET SDK for Data Management v2 API for Object Storage Service (OSS)
, for more information, please visit official documentation
<PackageReference Include="ricaun.Autodesk.Forge.Oss" Version="*" />
- .NET 6 or later
- A registered app on the Autodesk Platform Service.
- Autodesk.Forge assembly which provides services such as:
- Forge TwoLeggedApi
- Data Management BucketsApi
- Data Management ObjectsApi
By default the Forge credentials could be defined with the following environment variables:
FORGE_CLIENT_ID=<your client id>
FORGE_CLIENT_SECRET=<your client secret>
The package ricaun.Autodesk.Forge.Oss
use the namespace Autodesk.Forge.Oss
.
using Autodesk.Forge.Oss;
using System;
using System.Threading.Tasks;
internal class Program
{
public static async Task Main(string[] args)
{
var ossClient = new OssClient(new Configuration()
{
ClientId = "<your client id>",
ClientSecret = "<your client secret>"
});
var buckets = await ossClient.GetBucketsAsync();
Console.WriteLine(buckets);
}
}
Buckets buckets = await ossClient.GetBucketsAsync();
Bucket bucket = await ossClient.CreateBucketAsync(bucketKey);
Bucket bucket = await ossClient.TryGetBucketDetailsAsync(bucketKey);
Bucket bucket = await ossClient.GetBucketDetailsAsync(bucketKey);
await ossClient.DeleteBucketAsync(bucketKey);
BucketObjects bucketObjects = await ossClient.GetObjectsAsync(bucketKey);
Stream stream = await ossClient.GetObjectAsync(bucketKey, objectName);
ObjectDetails objectDetails = await ossClient.GetObjectDetailsAsync(bucketKey, objectName);
ObjectDetails objectDetails = await ossClient.UploadObjectAsync(bucketKey, objectName);
ObjectDetails objectDetails = await ossClient.UploadChunkAsync(bucketKey, objectName);
ObjectDetails objectDetails = await ossClient.CopyToAsync(bucketKey, objectName, newObjectName);
await ossClient.DeleteObjectAsync(bucketKey, objectName);
PostObjectSigned postObjectSigned = await ossClient.CreateSignedResourceAsync(bucketKey, objectName, postBucketsSigned);
ObjectDetails objectDetails = await ossClient.UploadFileAsync(bucketKey, objectName, localFullName);
await ossClient.DownloadFileAsync(bucketKey, objectName, localFullName);
string signedUrl = await ossClient.CreateSignedFileAsync(bucketKey, objectName);
string signedUrl = await ossClient.CreateSignedFileWriteAsync(bucketKey, objectName);
This project is licensed under the MIT Licence.
Do you like this project? Please star this project on GitHub!