Exemplo n.º 1
0
        public void CreateStopwordList()
        {
            IamConfig config = new IamConfig(
                apikey: apikey
                );

            DiscoveryService service = new DiscoveryService(versionDate, config);

            service.SetEndpoint(url);

            DetailedResponse <TokenDictStatusResponse> result;

            using (FileStream fs = File.OpenRead(stopwordFileToIngest))
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    fs.CopyTo(ms);
                    result = service.CreateStopwordList(
                        environmentId: environmentId,
                        collectionId: collectionId,
                        stopwordFile: ms,
                        stopwordFilename: Path.GetFileName(stopwordFileToIngest)
                        );
                }
            }

            Console.WriteLine(result.Response);
        }
        public void CreateStopwordList()
        {
            IamAuthenticator authenticator = new IamAuthenticator(
                apikey: "{apikey}");

            DiscoveryService service = new DiscoveryService("2019-04-30", authenticator);

            service.SetServiceUrl("{serviceUrl}");

            DetailedResponse <TokenDictStatusResponse> result;

            using (FileStream fs = File.OpenRead("{filepath}"))
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    fs.CopyTo(ms);
                    result = service.CreateStopwordList(
                        environmentId: "{environmentId}",
                        collectionId: "{collectionId}",
                        stopwordFile: ms,
                        stopwordFilename: "{filepath}"
                        );
                }
            }

            Console.WriteLine(result.Response);
        }
Exemplo n.º 3
0
        public void CreateStopwordList()
        {
            TokenOptions tokenOptions = new TokenOptions()
            {
                IamApiKey  = apikey,
                ServiceUrl = url
            };

            DiscoveryService service = new DiscoveryService(tokenOptions, versionDate);

            DetailedResponse <TokenDictStatusResponse> result;

            using (FileStream fs = File.OpenRead(stopwordFileToIngest))
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    fs.CopyTo(ms);
                    result = service.CreateStopwordList(
                        environmentId: environmentId,
                        collectionId: collectionId,
                        stopwordFile: ms,
                        stopwordFilename: Path.GetFileName(stopwordFileToIngest)
                        );
                }
            }

            Console.WriteLine(result.Response);
        }