Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #18 from xpouyat/dev
Browse files Browse the repository at this point in the history
Add support for .Net Core 3.1
  • Loading branch information
xpouyat authored Dec 18, 2023
2 parents 64f8bda + 199b4cf commit 571cb6f
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 47 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,4 @@ MigrationBackup/
FodyWeavers.xsd
/SampleNet7.0/appsettings.json
/SampleNetFramework4.8/appsettings.json
/SampleCore3.1/appsettings.json
9 changes: 9 additions & 0 deletions MK.IO.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleNetFramework4.8", "Sa
{D49EB09F-BB45-446F-8CC6-29E1C6E73EFB} = {D49EB09F-BB45-446F-8CC6-29E1C6E73EFB}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCore3.1", "SampleCore3.1\SampleCore3.1.csproj", "{7E4DC505-6D8E-4210-9EB1-9A71F0754D60}"
ProjectSection(ProjectDependencies) = postProject
{D49EB09F-BB45-446F-8CC6-29E1C6E73EFB} = {D49EB09F-BB45-446F-8CC6-29E1C6E73EFB}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -30,6 +35,10 @@ Global
{FD73FD43-77EF-4057-B13D-98FC72F8F2C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FD73FD43-77EF-4057-B13D-98FC72F8F2C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FD73FD43-77EF-4057-B13D-98FC72F8F2C7}.Release|Any CPU.Build.0 = Release|Any CPU
{7E4DC505-6D8E-4210-9EB1-9A71F0754D60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E4DC505-6D8E-4210-9EB1-9A71F0754D60}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E4DC505-6D8E-4210-9EB1-9A71F0754D60}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E4DC505-6D8E-4210-9EB1-9A71F0754D60}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Binary file added MK.IO/Icon/mkio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 13 additions & 4 deletions MK.IO/MK.IO.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net48</TargetFrameworks>
<TargetFrameworks>net7.0;net48;netcoreapp3.1</TargetFrameworks>
<LangVersion>10.0</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand All @@ -11,14 +11,15 @@
<Description>A client library for MediaKind MK/IO.</Description>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Version>1.0.9</Version>
<Version>1.0.10</Version>
<RepositoryUrl>https://github.com/xpouyat/MK.IO</RepositoryUrl>
<PackageProjectUrl>https://github.com/xpouyat/MK.IO/blob/master/README.md</PackageProjectUrl>
<AssemblyVersion>1.0.9.0</AssemblyVersion>
<FileVersion>1.0.9.0</FileVersion>
<AssemblyVersion>1.0.10.0</AssemblyVersion>
<FileVersion>1.0.10.0</FileVersion>
<Title>A client library for MediaKind MK/IO.</Title>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageIcon>mkio.png</PackageIcon>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -53,4 +54,12 @@
<Folder Include="CsharpDotNet2\Model\" />
</ItemGroup>


<ItemGroup>
<None Update="Icon\mkio.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

</Project>
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ var stats = client.Account.GetSubscriptionStats();
var mkioAssets = client.Assets.List();

// list assets with pages
var mkioAssetsResult = client.Assets.ListAsPage("name desc", 10);
do
var mkioAssetsResult = client.Assets.ListAsPage("properties/created desc", 10);
while (true)
{
// do stuff here using mkioAssetsResult.Results
if (mkioAssetsResult.NextPageLink == null) break;
mkioAssetsResult = client.Assets.ListAsPageNext(mkioAssetsResult.NextPageLink);
// do stuff
} while (mkioAssetsResult.NextPageLink != null);
}

// get asset
var mkasset = client.Assets.Get("mmyassetname");
Expand Down
53 changes: 53 additions & 0 deletions SampleCore3.1/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using Microsoft.Extensions.Configuration;
using System;
using MK.IO;
using MK.IO.Models;
using System.Linq;

namespace SampleCore
{
internal class Program
{
static void Main(string[] args)
{
// load settings from appsettings.json
IConfigurationRoot config = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.Build();

Console.WriteLine($"Using '{config["MKIOSubscriptionName"]}' MK/IO subscription.");

// **********************
// MK/IO Client creation
// **********************

var client = new MKIOClient(config["MKIOSubscriptionName"], config["MKIOToken"]);

MKIOClient.GenerateUniqueName("asset");

try
{
var profile = client.Account.GetUserProfile();
}
catch (ApiException ex)
{
Console.WriteLine(ex.Message);
Environment.Exit(0);
}


// Get subscription stats
var stats = client.Account.GetSubscriptionStats();

var subs = client.Account.ListAllSubscriptions();
var sub = client.Account.GetSubscription();
var locs = client.Account.ListAllLocations();

var currentLocation = locs.Where(l => l.Metadata.Id == sub.Spec.LocationId).FirstOrDefault();
Console.WriteLine($"Connected to '{sub.Spec.Name}' MK/IO instance in region '{currentLocation.Metadata.Name}'.");

// pause the command line
Console.ReadLine();
}
}
}
23 changes: 23 additions & 0 deletions SampleCore3.1/SampleCore3.1.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>SampleCore</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MK.IO\MK.IO.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
81 changes: 43 additions & 38 deletions SampleNet7.0/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,46 @@ static async Task MainAsync()
var sub = await client.Account.GetSubscriptionAsync();
var locs = await client.Account.ListAllLocationsAsync();

// *****************
// asset operations
// *****************

// list assets

var mkioAssetsResult = client.Assets.ListAsPage("properties/created desc", 10);
while (true)
{
foreach (var a in mkioAssetsResult.Results)
{
Console.WriteLine(a.Name);
}
if (mkioAssetsResult.NextPageLink == null) break;

mkioAssetsResult = client.Assets.ListAsPageNext(mkioAssetsResult.NextPageLink);
}

var specc = client.Assets.ListTracksAndDirListing("copy-ef2058b692-copy");

// get streaming locators for asset
try
{
var locatorsAsset = client.Assets.ListStreamingLocators("uploaded-c9c6146a98-CustomPreset-AutoFit-57653ac7b8-autofit");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}


// get asset
var mkasset = client.Assets.Get("copy-152b839997");

// create asset
// var newasset = client.Assets.CreateOrUpdate("copy-ef2058b692-copy", "asset-2346d605-b4d6-4958-a80b-b4943b602ea8", "amsxpfrstorage", "description of asset copy");

// delete asset
// client.Assets.Delete("asset-33adc1873f");


// ************************
// asset filter operations
Expand Down Expand Up @@ -174,49 +214,14 @@ static async Task MainAsync()
client.AccountFilters.Delete(filter.Name);


// *****************
// asset operations
// *****************

// list assets
//var mkioAssets = client.Assets.List("name desc", 4);


var mkioAssetsResult = client.Assets.ListAsPage("name desc", 4);
do
{
mkioAssetsResult = client.Assets.ListAsPageNext(mkioAssetsResult.NextPageLink);
} while (mkioAssetsResult.NextPageLink != null);


var specc = client.Assets.ListTracksAndDirListing("copy-ef2058b692-copy");

// get streaming locators for asset
try
{
var locatorsAsset = client.Assets.ListStreamingLocators("uploaded-c9c6146a98-CustomPreset-AutoFit-57653ac7b8-autofit");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}


// get asset
var mkasset = client.Assets.Get("copy-152b839997");

// create asset
// var newasset = client.Assets.CreateOrUpdate("copy-ef2058b692-copy", "asset-2346d605-b4d6-4958-a80b-b4943b602ea8", "amsxpfrstorage", "description of asset copy");

// delete asset
// client.Assets.Delete("asset-33adc1873f");


// *********************
// transform operations
// *********************


var tranform = client.Transforms.CreateOrUpdate("simpleTransformSD", new TransformProperties
{
Description = "desc",
Expand All @@ -228,7 +233,7 @@ static async Task MainAsync()
}
}
});

// ***************
// job operations
// ***************
Expand Down Expand Up @@ -439,7 +444,7 @@ static async Task MainAsync()
// client.StorageAccounts.Delete(storages.First().Metadata.Id);






Expand Down
2 changes: 1 addition & 1 deletion SampleNetFramework4.8/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System;
using System.Linq;

namespace ConsoleApp1
namespace SampleNetFramework
{
internal class Program
{
Expand Down

0 comments on commit 571cb6f

Please sign in to comment.