Skip to content
This repository was archived by the owner on Oct 7, 2026. It is now read-only.
OcctooPublic archive

About

Wrapped httpclient used to create a Nuget package for calling Occtoos onboarding API.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Latest commit

 

History

28 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Archived: This repository is no longer actively maintained. Please use Occtoo SDK instead. The code remains available for reference.

Introduction

Wrapped httpclient used to create a Nuget package for calling onboarding.

Gettings started with Onboarding Service Client

  • Open your solution and add the package through nuget.

  • Create a instance of the OnboardingServiceClient and provide your Provider-Id and -Secret.

    (Follow these steps to setup your Provider, if you do not have one.)

  • Call one of the four overloads of StartEntityImportAsync

Quick Start Example

private readonly string dataProviderId = config["providerid"];
private readonly string dataProviderSecret= config["providersecret"];

static async Task Main(string[] args)
{
    var enties = new List<DynamicEntity>
    {
        new DynamicEntity
        {
            Key = "1",
            Properties= {new DynamicProperty { Id= "name", Value = "number one" }}
        },
        new DynamicEntity
        {
            Key = "2",
            Properties= {new DynamicProperty { Id= "name", Value = "number two" }}
        }
    };

    var onboardingServiceClient = new OnboardingServiceClient(dataProviderId, dataProviderSecret);
    var response = await onboardingServiceClient.StartEntityImportAsync(dataSource, enties);
    if(response.StatusCode == 202)
    {
        // Data was onboarded!
    }
}

Media Onboarding Example

private readonly string dataProviderId = config["providerid"];
private readonly string dataProviderSecret= config["providersecret"];
private readonly string dataSource = "Media";

static async Task Main(string[] args)
{
    var onboardingServiceClient = new OnboardingServiceClient(dataProviderId, dataProviderSecret);
    var fileToUpload = new FileUploadFromLink(
                "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png",
                "googlelogo_color_272x92dp.png", 
                "googleLogo");
    var response = await onboardingServiceClient.UploadFromLinkAsync(fileToUpload);
    if(response.StatusCode == 200)
    {
        // Media was onboarded!
        // Lets make a datasource to show in the api
        var uploadDto = response.Result;
        var enties = new List<DynamicEntity>
        {
            new DynamicEntity
            {
                Key = uploadDto.Id,
                Properties= {
                    new DynamicProperty { Id= "url", Value = uploadDto.PublicUrl },
                    new DynamicProperty { Id= "name", Value = uploadDto.MetaData.Filename },
                    new DynamicProperty { Id= "mimeType", Value = uploadDto.MetaData.MimeType },
                    new DynamicProperty { Id= "size", Value = uploadDto.MetaData.Size.ToString() }                    
                }
            },
        };

        var response = await onboardingServiceClient.StartEntityImportAsync(dataSource, enties);
        if(response.StatusCode == 202)
        {
            // Data was onboarded!
        }
    }
}

About

Wrapped httpclient used to create a Nuget package for calling Occtoos onboarding API.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages