Skip to content

Latest commit

 

History

History
108 lines (82 loc) · 3.89 KB

README.md

File metadata and controls

108 lines (82 loc) · 3.89 KB

Autodesk.Forge.Oss

Visual Studio 2022 Nuke License MIT Build Nuget

Overview

.NET SDK for Data Management v2 API for Object Storage Service (OSS), for more information, please visit official documentation

PackageReference

<PackageReference Include="ricaun.Autodesk.Forge.Oss" Version="*" />

Requirements

Dependencies

Configuration

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>

API Reference

The package ricaun.Autodesk.Forge.Oss use the namespace Autodesk.Forge.Oss.

OssClient

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);
    }
}

Bundle

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);

Object

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);

Signed

PostObjectSigned postObjectSigned = await ossClient.CreateSignedResourceAsync(bucketKey, objectName, postBucketsSigned);

FileExtension

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);

Release

License

This project is licensed under the MIT Licence.


Do you like this project? Please star this project on GitHub!