public void WithGroupId_CreateDataset_MatchesDocumentation() { var expected = "v1.0/myorg/groups/123/datasets?defaultRetentionPolicy={defaultRetentionPolicy}"; var addresses = new PowerBiAddresses(); var actual = addresses.CreateDataset("123"); Assert.AreEqual(expected, actual); }
public async Task <Dataset> Create(string groupId, string datasetName, bool useBasicFifoRetentionPolicy, params Type[] tableStructures) { var defaultRetentionPolicy = useBasicFifoRetentionPolicy ? "basicFIFO" : "None"; var tables = tableStructures.Select(t => Table.FromType(t)).ToList(); var dataset = new Dataset { name = datasetName, tables = tables }; var request = new RestRequest(_addresses.CreateDataset(groupId), Method.POST) { JsonSerializer = new Serialization.JsonSerializer() }; request.RequestFormat = DataFormat.Json; request.AddUrlSegment("defaultRetentionPolicy", defaultRetentionPolicy); request.AddBody(dataset); var response = await _client.ExecuteTaskAsync <Dataset>(request); ResponseValidation.HandleResponseErrors(response); return(response.Data); }