public void GetCollection() { Console.WriteLine(string.Format("\nCalling GetCollection()...")); if (string.IsNullOrEmpty(_createdEnvironmentId)) { Assert.Fail("_createdEnvironmentId is null"); } if (string.IsNullOrEmpty(_createdCollectionId)) { Assert.Fail("_createdCollectionId is null"); } var result = _discovery.GetCollection(_createdEnvironmentId, _createdCollectionId); if (result != null) { Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented)); } else { Console.WriteLine("result is null."); } Assert.IsNotNull(result); Assert.IsTrue(result.CollectionId == _createdCollectionId); Assert.IsTrue(result.Name == _createdCollectionName); Assert.IsTrue(result.Description == _createdCollectionDescription); }
//[TestMethod] public void TestGetCollection() { service.WithHeader("X-Watson-Test", "1"); var listCollectionsResult = service.ListCollections( projectId: projectId ); var collections = listCollectionsResult.Result.Collections; if (collections.Count > 0) { var getCollectionResult = service.GetCollection( projectId: projectId, collectionId: collections[0].CollectionId ); Assert.IsNotNull(getCollectionResult.Response); Assert.IsNotNull(getCollectionResult.Result.CollectionId); Assert.IsTrue(getCollectionResult.Result.Name == collections[0].Name); } }
private void GetCollection() { Console.WriteLine(string.Format("\nCalling GetCollection()...")); var result = _discovery.GetCollection(_createdEnvironmentId, _createdCollectionId); if (result != null) { Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented)); } else { Console.WriteLine("result is null."); } }
public void GetCollection() { IamAuthenticator authenticator = new IamAuthenticator( apikey: "{apikey}"); DiscoveryService service = new DiscoveryService("2019-04-30", authenticator); service.SetServiceUrl("{serviceUrl}"); var result = service.GetCollection( environmentId: "{environmentId}", collectionId: "{collectionId}" ); Console.WriteLine(result.Response); }
static void Main(string[] args) { TokenOptions tokenOptions = new TokenOptions { IamApiKey = "", ServiceUrl = "https://gateway.watsonplatform.net/discovery/api/" }; DiscoveryService discoveryService = new DiscoveryService(tokenOptions, "2019-04-30"); string envid = ""; string colid = ""; DetailedResponse <Collection> resp = discoveryService.GetCollection(envid, colid); Console.WriteLine(resp.Response); Console.ReadKey(); }
public void GetCollection() { IamConfig config = new IamConfig( apikey: apikey ); DiscoveryService service = new DiscoveryService(versionDate, config); service.SetEndpoint(url); var result = service.GetCollection( environmentId: environmentId, collectionId: collectionId ); Console.WriteLine(result.Response); }
public void GetCollection() { TokenOptions tokenOptions = new TokenOptions() { IamApiKey = apikey, ServiceUrl = url }; DiscoveryService service = new DiscoveryService(tokenOptions, versionDate); var result = service.GetCollection( environmentId: environmentId, collectionId: collectionId ); Console.WriteLine(result.Response); }
public IEnumerator TestGetCollection() { Log.Debug("DiscoveryServiceV2IntegrationTests", "Attempting to GetCollection..."); CollectionDetails collectionDetailsResponse = null; service.GetCollection( callback: (DetailedResponse <CollectionDetails> response, IBMError error) => { Log.Debug("DiscoveryServiceV2IntegrationTests", "GetCollection result: {0}", response.Response); collectionDetailsResponse = response.Result; Assert.IsNotNull(collectionDetailsResponse); Assert.IsNull(error); }, projectId: projectId, collectionId: collectionId ); while (collectionDetailsResponse == null) { yield return(null); } }