From 7048536e4bcfd0b23ef33b6186aa95f206070300 Mon Sep 17 00:00:00 2001 From: Xavier Pouyat Date: Mon, 18 Dec 2023 10:43:32 +0100 Subject: [PATCH 1/2] Update for listing assets --- README.md | 9 +++-- SampleNet7.0/Program.cs | 81 ++++++++++++++++++++++------------------- 2 files changed, 48 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 3cc43dd..625bd2a 100644 --- a/README.md +++ b/README.md @@ -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"); diff --git a/SampleNet7.0/Program.cs b/SampleNet7.0/Program.cs index 87773ba..2e877a7 100644 --- a/SampleNet7.0/Program.cs +++ b/SampleNet7.0/Program.cs @@ -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 @@ -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", @@ -228,7 +233,7 @@ static async Task MainAsync() } } }); - + // *************** // job operations // *************** @@ -439,7 +444,7 @@ static async Task MainAsync() // client.StorageAccounts.Delete(storages.First().Metadata.Id); - + From 199b4cf2d3e7278ec0624f593c210933e0e3c489 Mon Sep 17 00:00:00 2001 From: Xavier Pouyat Date: Mon, 18 Dec 2023 11:24:09 +0100 Subject: [PATCH 2/2] Add support for .Net Core 3.1 Add a MK/IO icon --- .gitignore | 1 + MK.IO.sln | 9 +++++ MK.IO/Icon/mkio.png | Bin 0 -> 4713 bytes MK.IO/MK.IO.csproj | 17 ++++++--- SampleCore3.1/Program.cs | 53 +++++++++++++++++++++++++++++ SampleCore3.1/SampleCore3.1.csproj | 23 +++++++++++++ SampleNetFramework4.8/Program.cs | 2 +- 7 files changed, 100 insertions(+), 5 deletions(-) create mode 100644 MK.IO/Icon/mkio.png create mode 100644 SampleCore3.1/Program.cs create mode 100644 SampleCore3.1/SampleCore3.1.csproj diff --git a/.gitignore b/.gitignore index 5e944a6..f404018 100644 --- a/.gitignore +++ b/.gitignore @@ -363,3 +363,4 @@ MigrationBackup/ FodyWeavers.xsd /SampleNet7.0/appsettings.json /SampleNetFramework4.8/appsettings.json +/SampleCore3.1/appsettings.json diff --git a/MK.IO.sln b/MK.IO.sln index 6412fcb..023e375 100644 --- a/MK.IO.sln +++ b/MK.IO.sln @@ -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 @@ -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 diff --git a/MK.IO/Icon/mkio.png b/MK.IO/Icon/mkio.png new file mode 100644 index 0000000000000000000000000000000000000000..4c8b68db30442d5c4f963aa813d6e6d0f5d7f932 GIT binary patch literal 4713 zcmc&&_fr%4v;71kgepzA^e#ma1St^&q-X?b7C@1HFCZPn7$B4@AWfPeH9!!NqVy7K z=+c9rD53X=h8iJ+`uxtkH}5}q?}yzpXMfl;vopIpb7IU)Zm}})GXVftZzJ^Y{=u;S z1dRSq?$UA?`~#4ucW>!}a)RL69|Co`VSEFCszl}^hqHe;qYvWYQvk%&{u2;otGqw} zI8JWs-?)#mUB@t>xW{>V)ofsl#$u^DKkn*UnnMZ^9QyZl^mRnpt@RBqS>as_@*D$H zmq#NaVB(_DSaDdfsH4Hz!dSz5?9A9OzggN`V@gg=4l!ru6285aba*0idykNl85BaD zemXL=sIgM}@?By1RS;`*2HWs|4@@5{Pd~5%Lrbrlg>ovRca7g<^MiTbi+qn_i|;zI zhK-E@naiwUi~kLB{ooxY@S2pRhv><(gXvOki|V8AYZS9ixMSLS8Z?n;3Kz7Ueg2T zW`#!nx?h3t^Fx7ew5$$guWOft{Z!dR;Kv@`VDGN#`eo^Hr(mEKTV#lP*HXKh+SArc znJZhT>kgJoEz{dx`8ihk%d1Fj*7mlyLTKL2*}yy?T7nKHEt%YWBMDwF97V7+9hD0F zNYp-+{NOp;lvB-LSAfbbaSl>%glGiq$(B7a*vYJohzw=krw+x&%gl~FPoAJ{laCsd z>Rda&rvJSeB0&AEpP;UCU0y>v(vS%_uJXc9EB$X_uWxO-^rzo{P}}n;k(ij-_BsbI zy7Ed~o-`L#q{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48;netcoreapp3.1 10.0 enable enable @@ -11,14 +11,15 @@ A client library for MediaKind MK/IO. LICENSE.txt README.md - 1.0.9 + 1.0.10 https://github.com/xpouyat/MK.IO https://github.com/xpouyat/MK.IO/blob/master/README.md - 1.0.9.0 - 1.0.9.0 + 1.0.10.0 + 1.0.10.0 A client library for MediaKind MK/IO. True snupkg + mkio.png @@ -53,4 +54,12 @@ + + + + True + \ + + + diff --git a/SampleCore3.1/Program.cs b/SampleCore3.1/Program.cs new file mode 100644 index 0000000..e505c1a --- /dev/null +++ b/SampleCore3.1/Program.cs @@ -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(); + } + } +} diff --git a/SampleCore3.1/SampleCore3.1.csproj b/SampleCore3.1/SampleCore3.1.csproj new file mode 100644 index 0000000..c0ca8ad --- /dev/null +++ b/SampleCore3.1/SampleCore3.1.csproj @@ -0,0 +1,23 @@ + + + + Exe + netcoreapp3.1 + SampleCore + + + + + + + + + + + + + PreserveNewest + + + + diff --git a/SampleNetFramework4.8/Program.cs b/SampleNetFramework4.8/Program.cs index c7c32fc..468b0c6 100644 --- a/SampleNetFramework4.8/Program.cs +++ b/SampleNetFramework4.8/Program.cs @@ -6,7 +6,7 @@ using System; using System.Linq; -namespace ConsoleApp1 +namespace SampleNetFramework { internal class Program {