private static void TestBatches(M2XClient m2x) { Console.WriteLine("Testing batches..."); var batches = m2x.GetBatches(); Console.WriteLine("Number of batches = " + batches.batches.Count); var batchName = "test-" + Guid.NewGuid(); var batchData = m2x.CreateBatch(batchName, M2XVisibility.Public, "description"); Console.WriteLine("New batch created - id = " + batchData.id); var bKey = batchData.key; M2XBatch batch = m2x.GetBatch(batchData.id); Console.WriteLine("Batch name = " + batch.Details().name); batch.Update(batchName + "updated", M2XVisibility.Public); Console.WriteLine("Batch updated"); var dss = batch.GetDataSources(); Console.WriteLine("Number of data sources in the batch = " + dss.datasources.Count); var dsSerial = "serial-" + Guid.NewGuid(); var dsData = batch.AddDataSource(dsSerial); Console.WriteLine("New data source added - id = " + dsData.id); var dsKey = dsData.key; M2XDataSource ds = m2x.GetDataSource(dsData.id); ds.Delete(); Console.WriteLine("Data source deleted"); DeleteKey(m2x, dsKey); batch.Delete(); Console.WriteLine("Batch deleted"); DeleteKey(m2x, bKey); }
private static void TestDatasources(M2XClient m2x) { Console.WriteLine("Testing data sources..."); var dss = m2x.GetDataSources(); Console.WriteLine("Number of data sources = " + dss.datasources.Count); var dsName = "test-" + Guid.NewGuid(); var dsData = m2x.CreateDataSource(dsName, M2XVisibility.Public, "description"); Console.WriteLine("New data source created - id = " + dsData.id); var key = dsData.key; M2XDataSource ds = m2x.GetDataSource(dsData.id); Console.WriteLine("Data source name = " + ds.Details().name); ds.Update(dsName + "updated", M2XVisibility.Public); Console.WriteLine("Data source updated"); ds.Delete(); Console.WriteLine("Data source deleted"); DeleteKey(m2x, key); }